Deploying website from private Github repository u

2019-03-20 07:45发布

I am trying to create a website through Azure Resource Manager and then deploy from a private Github repository.

I have an ARM Template that works for a public repository. if I then make the repository private, connect to it through the Portal it all works fine.

If I redeploy the ARM Template it will fail with the message

"Cannot find SourceControlToken with name GitHub."

It seems that when the portal connects to a private repo it will create an ssh key that is used to authenticate.

The ssh key appears to come from kudu which can be gotten once the site is deployed.

I have also tried using access tokens, but couldn't get these to work with the repourl

So the simple question is, how do I deploy a private repo via ARM template

2条回答
冷血范
2楼-- · 2019-03-20 07:58

It seems that when the portal connects to a private repo it will create an ssh key that is used to authenticate.

Thats right.

Solve same problem by changing GitHub repository to External Git.

  • Create new GitHub account and shared read access to private repo
  • Generate access token
  • And use next url in templates, in portal, azure rest api, etc.

    https://{github-username}:{access-token}@github.com/{organisation-acount}/{repo}.git

Besides, this will help to avoid GitHub limitation for 20 connections, and you can use your repository in more than 20 Azure WebApps.

查看更多
混吃等死
3楼-- · 2019-03-20 08:11

In order to use this via ARM template, you need to first do it at least once using the Preview Portal (https://portal.azure.com/). You can do this on any site, and with any repo. It just needs to happen once to set up the GitHub relationship. Doing it via the old portal won't work.

Then, to check that things are set up properly:

查看更多
登录 后发表回答