@Diana Annie Jenosh Thank you for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
Yes, using Microsoft.Web/sites/sourcecontrols
type in your ARM template you can connect the function app to specific GitHub repo and deploy the function code accordingly.
To test this, I have created a sample ARM template which will deploy the function app (runtime python on Linux App service Plan) and also it will deploy the source code of function from the connected GitHub repo.
Here is the ARM template:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName":{
"type": "string"
},
"serverFarmeName": {
"type": "string"
},
"applicationInsightsName": {
"type": "string"
},
"functionAppName":{
"type" : "string"
}
},
"functions": [],
"variables": {},
"resources": [
{
"type" : "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-08-01",
"name":"[parameters('storageAccountName')]",
"kind": "Storage",
"location":"[resourceGroup().location]",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2021-03-01",
"location":"[resourceGroup().location]",
"name":"[parameters('serverFarmeName')]",
"sku": {
"name": "P1v2",
"tier": "PremiumV2",
"size": "P1v2",
"family":"Pv2",
"capacity": 1
},
"properties": {
"hyperV": false,
"isXenon": false,
"reserved": true
}
},
{
"type": "Microsoft.Insights/components",
"apiVersion": "2020-02-02-preview",
"name":"[parameters('applicationInsightsName')]",
"location":"[resourceGroup().location]",
"properties": {
"Application_Type": "web",
"DisableIpMasking": true
}
},
{
"name": "[parameters('functionAppName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2021-03-01",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
"[resourceId('Microsoft.Insights/components', parameters('applicationInsightsName'))]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('serverFarmeName'))]",
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value,';EndpointSuffix=','core.windows.net')]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('Microsoft.Insights/components',parameters('applicationInsightsName')), '2015-05-01').InstrumentationKey]"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "python"
},
{
"name":"APPLICATIONINSIGHTS_CONNECTION_STRING",
"value":"[reference(resourceId('Microsoft.Insights/components',parameters('applicationInsightsName')),'2015-05-01').ConnectionString]"
},
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~18"
},
],
"linuxFxVersion": "PYTHON|3.9",
"alwaysOn": true,
"use32BitWorkerProcess": true
}
},
"resources" :[
{
"type": "sourcecontrols",
"apiVersion": "2022-09-01",
"name":"web",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('functionAppName'))]"
],
"properties": {
"branch":"master",
"repoUrl": "<Pass_the_required_githubURl>",
"isManualIntegration": true
}
}
]
}
],
"outputs": {}
}
Note : Please do Update the branch name, and GitHub repo URL in source controls block in the above ARM template. We have tested this, and it is working fine from our end. I would suggest you check from your end as well. Feel free to reach back to me if you have any further questions on this.