Soru

Zorluk: OrtaConfigure Azure App Service Web Apps

A developer is configuring local Git deployment for an Azure App Service web app named `app-hr-prod`. The developer needs to set up deployment credentials, retrieve the Git clone URL, and push the application code from a local repository to Azure.

Which sequence of steps should the developer perform to complete this configuration?

  1. 1Configure user-level deployment credentials by executing: az webapp deployment user set --user-name <username> --password <password>
  2. 2Enable local Git deployment for the web app by executing: az webapp deployment source config-local-git --name app-hr-prod --resource-group hr-rg
  3. 3Register the Azure Git clone URL as a remote named 'azure' within the local Git repository: git remote add azure <git-clone-url>
  4. 4Deploy the application code to Azure by executing: git push azure main

Cevap

Configure user-level deployment credentials, enable local Git deployment on the App Service, add the generated Git URL as a remote in your local repository, and push the code.
To configure local Git deployment for an Azure App Service web app, you must first establish the user-level deployment credentials. Next, you enable local Git deployment on the App Service web app to generate the Git repository clone URL. You then register this URL as a remote destination in your local Git repository. Finally, you push the local branch to the Azure remote to build and deploy the web application.

Adım Adım Çözüm

1
Run `az webapp deployment user set` to configure deployment credentials.
User-level deployment credentials are established globally for the Azure subscription.
A deployment user must be configured to authenticate local Git push requests to Azure App Service.
2
Run `az webapp deployment source config-local-git` for the target web app.
Local Git deployment is enabled on the web app, and the Azure Git repository URL is returned.
This exposes the endpoint needed to associate the local Git repository with the Azure host.
3
Run `git remote add azure <url>` inside the local repository directory.
The local repository has a new Git remote named 'azure' pointing to the App Service repository.
Git needs the remote URL configured locally before it can transmit code to that endpoint.
4
Run `git push azure main` to push code to Azure.
The code is uploaded, built, and deployed to the active App Service slot.
Pushing the commits triggers the deployment workflow on Azure App Service.

Anahtar Kavram

Local Git deployment configuration for Azure App Service
Bu soruyu puanla