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
Thats right.
Solve same problem by changing GitHub repository to External Git.
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.
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:
/providers/Microsoft.Web/sourcecontrols/GitHub
token
is set