Now that you have set up your local git repository, you need to add Azure as a remote for our local repository.
Once you have configured Azure as Git’s remote repository, you will be able to deploy our .NET Core Application.
In this task, you will configure your Azure Web App to be the remote for your local Git repository and verify that Azure has completed the deployment.
- Open your web browser and navigate to the Azure portal https://portal.azure.com
- On your Azure dashboard, open a blade for the Web App that you created earlier in this lab.
- On the left navigation pane, under DEPLOYMENT, click Deployment credentials.
- Enter a Username and Password.The Username and Password that you specify as your Deployment credentials will be stored with your Azure account. You will use these credentials when you complete a Git or FTP deployment to Azure.
- On the left navigation pane, under DEPLOYMENT, click Deployment options.
- On the Deployment option blade, click Chose Source, and then click Local Git Repository.
- To save your changes, click OK.Don’t worry about the performance test option.
- On the left navigation pane, click Overview.
- Notice that the Essentials pane includes a new value for Git/Deployment username and Git clone url.We will be using the values assigned to these settings to complete the upcoming steps in Visual Studio Code.
- Switch to Visual Studio Code.
- On the View menu, click Integrated Terminal.The Integrated Terminal panel in Visual Studio Code enables you to enter commands in a way that is similar to using a command prompt.
- In the Terminal panel, at the command prompt, type git remote add azure and then press Space.
- Paste-in the value of the Git clone url that you copied from your Azure dashboard, and then press Enter.Your command should be similar to the following example: “git remote add azure https://petswithhats.scm.azurewebsites.net:443/petswithhats.git”With this step completed, you have added a remote repository named “azure” and specified the location of the remote repository. The name “azure” that you specified describes that the location is in Azure, it is not a keyword representing Azure.
Note: Git supports the creation of additional remote repositories using the “git remote add ” command. This can be useful when considering more advanced scenarios, such as deploying code revisions to a staging site before releasing to a production environment.
- At the command prompt, type git push azure master and then press Enter.This command initiates a Git push operation to push the file to the remote. Azure will now deploy your code and check for the server.js file.Note: When you enter the Git push command, you will be prompted to enter the Username and Password that you set up when you configured your Deployment credentials in Azure. If the password characters are not be displayed as you type them, don’t worry, they will be recognized.
- Examine the output displayed in the Terminal panel.
- Navigate to the URL for your site. Your Web site should now be displaying your application!