Created
January 16, 2022 17:29
-
-
Save CtrlDot/620cc2b2c2f99783562c2be6abc62137 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"downloadUrl":{ | |
"type": "securestring" | |
} | |
}, | |
"functions": [], | |
"variables": { | |
"location":"[resourceGroup().location]", | |
"aspName":"[guid(resourceGroup().name,'asp')]", | |
"faspName":"[guid(resourceGroup().name,'fasp')]", | |
"faspStorageName":"[concat('tony',uniqueString(resourceGroup().id))]", | |
"web1Name":"[guid(resourceGroup().name,'web1')]", | |
"web2Name":"[guid(resourceGroup().name,'web2')]", | |
"managementName":"[guid(resourceGroup().name,'tonydanza')]", | |
"contributorRoleName": "[guid(resourceGroup().name,variables('managementName'),'contributor')]", | |
"contributorRoleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]", | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Web/serverfarms", | |
"apiVersion": "2021-02-01", | |
"name":"[variables('aspName')]", | |
"location": "[variables('location')]", | |
"sku": { | |
"name":"S1" | |
} | |
}, | |
{ | |
"type": "Microsoft.Web/sites", | |
"apiVersion": "2021-02-01", | |
"name":"[variables('web1Name')]", | |
"location":"[variables('location')]", | |
"dependsOn":[ | |
"[variables('aspName')]" | |
], | |
"properties":{ | |
"serverFarmId":"[resourceId('Microsoft.Web/serverfarms',variables('aspName'))]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Web/sites", | |
"apiVersion": "2021-02-01", | |
"name":"[variables('web2Name')]", | |
"location":"[variables('location')]", | |
"dependsOn":[ | |
"[variables('aspName')]" | |
], | |
"properties":{ | |
"serverFarmId":"[resourceId('Microsoft.Web/serverfarms',variables('aspName'))]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "2021-06-01", | |
"name":"[variables('faspStorageName')]", | |
"location":"[variables('location')]", | |
"kind": "StorageV2", | |
"sku":{ | |
"name": "Standard_LRS" | |
}, | |
"properties": { | |
"allowBlobPublicAccess": false, | |
"minimumTlsVersion": "TLS1_2", | |
"supportsHttpsTrafficOnly": true | |
} | |
}, | |
{ | |
"type":"Microsoft.Web/serverfarms", | |
"apiVersion":"2016-09-01", | |
"name":"[variables('faspName')]", | |
"location":"[resourceGroup().location]", | |
"properties":{ | |
"name":"[variables('faspName')]", | |
"computeMode":"Dynamic" | |
}, | |
"sku":{ | |
"name":"Y1", | |
"tier":"Dynamic", | |
"size":"Y1", | |
"family":"Y", | |
"capacity":0 | |
} | |
}, | |
{ | |
"type": "Microsoft.Web/sites", | |
"apiVersion": "2021-02-01", | |
"name":"[variables('managementName')]", | |
"location":"[variables('location')]", | |
"kind":"functionapp", | |
"dependsOn":[ | |
"[variables('faspName')]", | |
"[variables('faspStorageName')]" | |
], | |
"identity": { | |
"type": "SystemAssigned" | |
}, | |
"properties":{ | |
"serverFarmId":"[resourceId('Microsoft.Web/serverfarms',variables('faspName'))]", | |
"siteConfig":{ | |
"appSettings":[ | |
{ | |
"name":"AzureWebJobsStorage", | |
"value":"[concat('DefaultEndpointsProtocol=https;AccountName=', variables('faspStorageName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts',variables('faspStorageName')),'2019-06-01').keys[0].value)]" | |
}, | |
{ | |
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", | |
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('faspStorageName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts',variables('faspStorageName')),'2019-06-01').keys[0].value)]" | |
}, | |
{ | |
"name": "FUNCTIONS_EXTENSION_VERSION", | |
"value": "~4" | |
}, | |
{ | |
"name": "WEBSITE_NODE_DEFAULT_VERSION", | |
"value": "~14" | |
}, | |
{ | |
"name": "FUNCTIONS_WORKER_RUNTIME", | |
"value": "dotnet-isolated" | |
}, | |
{ | |
"name":"WEBSITE_RUN_FROM_PACKAGE", | |
"value":"[parameters('downloadUrl')]" | |
}, | |
{ | |
"name":"WEBAPP1_ID", | |
"value":"[resourceId('Microsoft.Web/sites',variables('web1Name'))]" | |
}, | |
{ | |
"name":"WEBAPP2_ID", | |
"value":"[resourceId('Microsoft.Web/sites',variables('web2Name'))]" | |
} | |
] | |
} | |
} | |
}, | |
{ | |
"type": "Microsoft.Authorization/roleAssignments", | |
"apiVersion":"2021-04-01-preview", | |
"name":"[variables('contributorRoleName')]", | |
"dependsOn":[ | |
"[variables('faspName')]" | |
], | |
"properties": { | |
"roleDefinitionId":"[variables('contributorRoleDefinitionId')]", | |
"principalId":"[reference(resourceId('Microsoft.Web/sites',variables('managementName')),'2021-01-15','Full').Identity.principalId]", | |
"principalType":"ServicePrincipal" | |
} | |
}, | |
{ | |
"type": "Microsoft.CustomProviders/resourceProviders", | |
"apiVersion": "2018-09-01-preview", | |
"name":"public", | |
"location":"[variables('location')]", | |
"dependsOn":[ | |
"[variables('faspName')]" | |
], | |
"properties": { | |
"actions":[ | |
{ | |
"name":"Restart", | |
"routingType": "Proxy", | |
"endpoint":"[concat('https://',variables('managementName'),'.azurewebsites.net/api/restart?code=',listkeys(concat(resourceId('Microsoft.web/sites',variables('managementName')), '/host/default/'),'2016-08-01').functionKeys.default)]" | |
} | |
] | |
} | |
} | |
], | |
"outputs": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment