简体   繁体   English

Azure webapp在创建后添加deploymentLocalGitUrl

[英]Azure webapp add deploymentLocalGitUrl after create

I'm trying out https://docs.microsoft.com/nl-nl/azure/app-service/app-service-web-get-started-html and of course, I'm not following stuff to the letter. 我正在尝试https://docs.microsoft.com/nl-nl/azure/app-service/app-service-web-get-started-html ,当然,我没有关注这些内容。

I already have a webapp (and the resource plan and stuff). 我已经有了一个webapp(以及资源​​计划和东西)。 I just want to want to add the local git stuff. 我只是想添加本地git的东西。 There's this property deploymentLocalGitUrl that should be there when I list the properties of the app in the CLI, but it's not there. 当我在CLI中列出应用程序的属性时,应该存在此属性deploymentLocalGitUrl,但它不在那里。 How can I add this, either through the CLI or the dashboard? 如何通过CLI或仪表板添加此项?

Thanks in advance. 提前致谢。

Cheers, Eric! 干杯,埃里克!

gitdirectory=<Replace with path to local Git repo>
username=<Replace with desired deployment username>
password=<Replace with desired deployment password>

After creating webapp on azure, configure the website for deployment via git. 在azure上创建webapp后,通过git配置网站以进行部署。 Set the account-level deployment credentials. 设置帐户级部署凭据。

$ az webapp deployment user set --user-name $username --password $password

This command will return the Git endpoint to push to which includes the UserName. 此命令将返回Git端点以推送到包含UserName的端点。

$ az webapp deployment source config-local-git --name mywebapp --resource-group myResourceGroup

It returns as below: 它返回如下:

{
  "url": "https://username@mywebapp.scm.azurewebsites.net/mywebapp.git"
}

With the endpoint in hand, cd to the git repo and set up a new remote in Git named azure. 使用端点,cd到git repo并在Git中设置一个名为azure的新远程。

$ cd $gitdirectory    //remember to git init before you cd

$ git remote add azure https://username@mywebapp.scm.azurewebsites.net/mywebapp.git

Finally, you could deploy the application to azure. 最后,您可以将应用程序部署到azure。

git push azure master

The properties you could see in portal as below: 您可以在门户中看到的属性如下: 在此输入图像描述

For more details, you could refer to this article and this one . 有关详细信息,你可以参考这个文章和这一个

It is a normal situation. 这是正常的情况。

Per my test, you could refer to the screenshots. 根据我的测试,你可以参考截图。

I created a web app with --deployment-local-git , we could find the deploymentLocalGitUrl in the operation result. 我使用--deployment-local-git创建了一个Web应用程序,我们可以在操作结果中找到deploymentLocalGitUrl

在此输入图像描述

Then I use az webapp show -n <webappname> -g <resourcegroupname> to get the properties of the web app. 然后我使用az webapp show -n <webappname> -g <resourcegroupname>来获取Web应用程序的属性。 We will not see the deploymentLocalGitUrl . 我们不会看到deploymentLocalGitUrl

在此输入图像描述

But we could find it in the azure portal. 但我们可以在天蓝色的门户网站上找到它。

在此输入图像描述

So, if you want to add the property, you could set it in the azure portal. 因此,如果要添加属性,可以在azure门户中进行设置。

在此输入图像描述

After setting it, you will be able to find the property mentioned in the screenshot above. 设置完成后,您将能够找到上面屏幕截图中提到的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM