Azure App services使用

本文指导如何通过Azure Cloud Shell使用PowerShell将Web应用代码部署到Azure Web App的预发布槽位,并验证部署结果。

实验内容链接:

https://microsoftlearning.github.io/AZ-104-MicrosoftAzureAdministrator/Instructions/Labs/LAB_09a-Implement_Web_Apps.html

 

需要注意几点:

 

在Azure Portal中找到  App services (不是App service plan等),开始创建Web App。

===========限制已经可以直接创建Web app,不需要再创建App services了。=============

Task4 在git push时提交到的是master分支,而有些仓库的默认分支是main,那么需要如下三步,新建master分支,切换至master分支,再上传。

PS /home/user/web> git branch master

PS /home/user/web> git checkout master
Switched to branch 'master'

PS /home/user/web> git branch
  main
* master
PS /home/user/web> git push fei@6666 master

 

如下为Task4

Task 4: Deploy code to the staging deployment slot

In this task, you will deploy code to the staging deployment slot.

  1. In the Azure portal, open the Azure Cloud Shell by clicking on the icon in the top right of the Azure Portal.

  2. If prompted to select either Bash or PowerShell, select PowerShell.

    Note: If this is the first time you are starting Cloud Shell and you are presented with the You have no storage mounted message, select the subscription you are using in this lab, and click Create storage.

  3. From the Cloud Shell pane, run the following to clone the remote repository containing the code for the web app.

    git clone https://github.com/Azure-Samples/php-docs-hello-world
    
  4. From the Cloud Shell pane, run the following to set the current location to the newly created clone of the local repository containing the sample web app code.

    Set-Location -Path $HOME/php-docs-hello-world/
    
  5. From the Cloud Shell pane, run the following to add the remote git (make sure to replace the [deployment_user_name] and [git_clone_url] placeholders with the value of the Deployment Credentials user name and Git Clone Url, respectively, which you identified in previous task):

    git remote add [deployment_user_name] [git_clone_url]
    

    Note: The value following git remote add does not have to match the Deployment Credentials user name, but has to be unique

  6. From the Cloud Shell pane, run the following to push the sample web app code from the local repository to the Azure web app staging deployment slot (make sure to replace the [deployment_user_name] placeholder with the value of the Deployment Credentials user name, which you identified in previous task):
    git push [deployment_user_name] master
    
  7. If prompted to authenticate, type the [deployment_user_name] and the corresponding password (which you set in the previous task).

  8. Close the Cloud Shell pane.

  9. On the staging slot blade, click Overview and then click the URL link to display the default web page in a new browser tab.

  10. Verify that the browser page displays the Hello World! message and close the new tab.

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值