ARM templates expect a public URL to download your templates. This allows you to use your private GitHub repo for Azure Linked ARM templates. The Azure Function is basically a proxy to GitHub. You can edit the Azure Function for your source control provider of choice.
- Create an Azure Function of type .NET named {Organization}GitHubProxy (the function name needs to be globally unique)
- Paste the Azure-Function.cs into a new function
- Login into GitHub
- Click on your name (top right)
- Select Settings
- Go to Developer Settings
- Go to Personal Access Token
- Click Generate New Token
- Give it name
- Select repo scope access
- Paste your Personal Access Token into the Azure Function
- string personalAcccessToken = "{REMOVED}";
- Press the "Get function URL" in the Azure Portal
- e.g. https://{functionAppName}.azurewebsites.net/api/{functionName}
- Add the query string &location={raw url in GitHub}
- Sample: https://{functionAppName}.azurewebsites.net/api/{functionName}?location=https://raw.githubusercontent.com/AdamPaternostro/GitHub-Azure-Function-Proxy-for-ARM-Template/master/README.md
- You can test this in a browser window
- You need to change the URL in the azuredeploy.json
# Login
az login
# Select Subscription
az account set -s REPLACE_ME
# Script parameters
resourceGroup="Azure-Function-Proxy"
location="eastus"
today=`date +%Y-%m-%d-%H-%M-%S`
deploymentName="MyDeployment-$today"
# Create resource group
az group create \
--name $resourceGroup \
--location $location
# Deploy the ARM template
az group deployment create \
--name $deploymentName \
--resource-group $resourceGroup \
--template-file azuredeploy.json
# Clean up resource group
az group delete --name $resourceGroup