I created a Function App through GitHub Action workflow and an ARM Template from Azure. It is a CI/CD workflow.
To deploy the Function App directly, I go to Deployment Center manually connect to GitHub. Then get the Publish Profile settings, and update the GitHub secret.
The manual process works! But if it is part of the ARM Template, the workflow fails.
I see a section in the ARM Template like below:
{
"type": "sourcecontrols",
"name": "web",
"apiVersion": "2020-12-01",
"properties": {
"RepoUrl": "[parameters('repoUrl')]",
"branch": "[parameters('branch')]",
"IsManualIntegration": false,
"deploymentRollbackEnabled": false,
"isMercurial": false,
"isGitHubAction": true,
"gitHubActionConfiguration": {
"generateWorkflowFile": false,
"workflowSettings": {
"appType": "functionapp",
"publishType": "code",
"os": "linux",
"runtimeStack": "dotnet",
"workflowApiVersion": "2020-12-01",
"slotName": "production",
"variables": {
"runtimeVersion": "7.0.x"
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('name'))]"
]
}
But the above generates the error:
ERROR: ***"status":"Failed","error":***"code":"DeploymentFailed","target":"/subscriptions/f24b12b1-d887-4938-8c49-ce56acded667/resourceGroups/MyResourceGroup/providers/Microsoft.Resources/deployments/azure-function-api","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[***"code":"NotFound","target":"/subscriptions/f24b12b1-d887-4938-8c49-ce56acded667/resourceGroups/MyResourceGroup/providers/Microsoft.Resources/deployments/azure-function-api","message":"***\r\n \"Code\": \"NotFound\",\r\n \"Message\": \"Cannot find SourceControlToken with name GitHub.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n ***\r\n \"Message\": \"Cannot find SourceControlToken with name GitHub.\"\r\n ***,\r\n ***\r\n \"Code\": \"NotFound\"\r\n ***,\r\n ***\r\n \"ErrorEntity\": ***\r\n \"ExtendedCode\": \"51004\",\r\n \"MessageTemplate\": \"Cannot find ***0*** with name ***1***.\",\r\n \"Parameters\": [\r\n \"SourceControlToken\",\r\n \"GitHub\"\r\n ],\r\n \"Code\": \"NotFound\",\r\n \"Message\": \"Cannot find SourceControlToken with name GitHub.\"\r\n ***\r\n ***\r\n ],\r\n \"Innererror\": null\r\n***"***]***
What configuration that I need to have so I can pass the above error?
Instead of the manual step, are there ARM Template commands to get the GitHub repository name, branch and copy the secret to the GitHub Settings\Secrets & Variables as Repository secrets?








