How to Deploy private GitHub repo to Azure Web service using ARM Templates

Harish Appana 0 Reputation points

Hi Team,

i was trying to deploy ARM templated from deploy from custome templates using ARM templates.

How to deploy private github repo code into my web service ?


Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,085 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 13,041 Reputation points

    Hello @Harish Appana ,

    Here are the steps to deploy a private GitHub repo to Azure Web App using ARM templates:

    1. Create a service principal in Azure AD with contributor access to your subscription. This will be used to access GitHub.
    2. Generate a personal access token in your GitHub account with repo and workflow scope.
    3. Store the GitHub PAT as a secret on the service principal.
    4. In your ARM template, add the source section to pull from GitHub:
    "resources": [
        "type": "sourcecontrols",  
        "apiVersion": "2021-03-01",
        "name": "web", 
        "location": "[resourceGroup().location]",
        "properties": {
          "repoUrl": "<owner>/<repo-name>.git",
          "branch": "main",
          "isManualIntegration": true,
          "deploymentRollbackEnabled": false,
          "githubActionConfiguration": {        
             "codeConfiguration": {
                "runtimeStack": "NODE|16-lts",
                "runtimeVersion": "16-lts"
    1. For the deployment section reference the sourceControl resource:
    Copy code
    "dependsOn": ["sourcecontrols/web"]

    Hope that helps.


    0 comments No comments