Example of Nested ARM template

{
 "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
 "contentVersion": "1.0.0.0",
 "parameters": {
   "AppInsights_name": {
     "type": "string"
   },
   "type": {
     "type": "string"
   },
   "regionId": {
     "type": "string"
   },   
   "WebAppName": {
     "type": "string",
     "metadata": {
       "description": "Name of the webapp"
     }
   },
   "hostingPlanName": {
     "type": "string",
     "metadata": {
       "description": "Name of the service plan name"
     }
   },
   "location": {
     "type": "string"
   },
   "RGName": {
     "type": "string"
   },
   "subscriptionId": {
     "type": "string"
   }   
 },
 "variables": {
   "WebAppName": "[concat(parameters('WebAppName'))]",
   "SlotName": "staging",
   "clientAffinityEnabled": false
 },
 "resources": [
   {
     "name": "[parameters('AppInsights_name')]",
     "type": "microsoft.insights/components",
     "location": "[parameters('regionId')]",
     "apiVersion": "2014-08-01",
     "properties": {
       "ApplicationId": "[parameters('AppInsights_name')]",
     }
   },
   {
     "name": "[parameters('WebAppName')]",
     "type": "Microsoft.Web/sites",
     "apiVersion": "2018-02-01",
     "properties": {       
       "name": "[parameters('WebAppName')]",
       "serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('RGName'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
     },
     "apiVersion": "2018-02-01",
     "location": "[parameters('location')]"         
 ],
 "outputs": {   
   "APPINSIGHTS_INSTRUMENTATIONKEY": {
     "value": "[reference(resourceId('microsoft.insights/components/', parameters('AppInsights_name')), '2015-05-01').InstrumentationKey]",
     "type": "string"
   },   
   "WebAppURL": {
     "type": "string",
     "value": "[concat('https://', reference(resourceId('Microsoft.Web/Sites', parameters('webAppName')),'2018-11-01').defaultHostName)]"
   }
 }
}

 

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s