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

Harish Appana 0 Reputation points
2023-11-01T03:11:38.1333333+00:00

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 ?

Thanks

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

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 18,646 Reputation points
    2023-11-05T23:48:02.0633333+00:00

    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": "https://github.com/<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.

    Grace

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.