diff --git a/.gitignore b/.gitignore index 37ed601bc..a7264cb4e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,9 @@ crash.log # Ignore deploymentVariables.json as it is specific to a single instantiation of MLZ deploymentVariables.json + +# Ignore compiled bicep files from the examples that use the shared deployment variables file pattern. +src/bicep/examples/appServicePlan/appService.json +src/bicep/examples/containerRegistry/contRegistry.json +src/bicep/examples/keyVault/azureKeyVault.json +src/bicep/examples/newWorkload/newWorkload.json diff --git a/src/bicep/examples/appServicePlan/appService.json b/src/bicep/examples/appServicePlan/appService.json deleted file mode 100644 index 8606f29b7..000000000 --- a/src/bicep/examples/appServicePlan/appService.json +++ /dev/null @@ -1,343 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.4.1008.15138", - "templateHash": "2691389334860595334" - } - }, - "parameters": { - "mlzDeploymentVariables": { - "type": "object", - "defaultValue": "[json('{\r\n \"mlzResourcePrefix\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"contoso\"\r\n },\r\n \"firewallPrivateIPAddress\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"10.0.100.4\"\r\n },\r\n \"hub\": {\r\n \"Type\": \"Object\",\r\n \"Value\": {\r\n \"subscriptionId\": \"093847b0-f0dd-428f-a0b0-bd4245b99339\",\r\n \"resourceGroupName\": \"contoso-hub\",\r\n \"resourceGroupResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-hub\",\r\n \"virtualNetworkName\": \"hub-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-hub/providers/Microsoft.Network/virtualNetworks/hub-vnet\",\r\n \"subnetName\": \"hub-vnet/hub-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-hub/providers/Microsoft.Network/virtualNetworks/hub-vnet/subnets/hub-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.100.128/27\",\r\n \"networkSecurityGroupName\": \"hub-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-hub/providers/Microsoft.Network/networkSecurityGroups/hub-nsg\"\r\n }\r\n },\r\n \"logAnalyticsWorkspaceName\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"contoso-laws\"\r\n },\r\n \"logAnalyticsWorkspaceResourceId\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-operations/providers/Microsoft.OperationalInsights/workspaces/contoso-laws\"\r\n },\r\n \"spokes\": {\r\n \"Type\": \"Array\",\r\n \"Value\": [\r\n {\r\n \"name\": \"operations\",\r\n \"subscriptionId\": \"093847b0-f0dd-428f-a0b0-bd4245b99339\",\r\n \"resourceGroupName\": \"contoso-operations\",\r\n \"resourceGroupId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-operations\",\r\n \"virtualNetworkName\": \"operations-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-operations/providers/Microsoft.Network/virtualNetworks/operations-vnet\",\r\n \"subnetName\": \"operations-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-operations/providers/Microsoft.Network/virtualNetworks/operations-vnet/subnets/operations-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.115.0/27\",\r\n \"networkSecurityGroupName\": \"operations-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-operations/providers/Microsoft.Network/networkSecurityGroups/operations-nsg\"\r\n },\r\n {\r\n \"name\": \"identity\",\r\n \"subscriptionId\": \"093847b0-f0dd-428f-a0b0-bd4245b99339\",\r\n \"resourceGroupName\": \"contoso-identity\",\r\n \"resourceGroupId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-identity\",\r\n \"virtualNetworkName\": \"identity-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-identity/providers/Microsoft.Network/virtualNetworks/identity-vnet\",\r\n \"subnetName\": \"identity-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-identity/providers/Microsoft.Network/virtualNetworks/identity-vnet/subnets/identity-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.110.0/27\",\r\n \"networkSecurityGroupName\": \"identity-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-identity/providers/Microsoft.Network/networkSecurityGroups/identity-nsg\"\r\n },\r\n {\r\n \"name\": \"sharedServices\",\r\n \"subscriptionId\": \"093847b0-f0dd-428f-a0b0-bd4245b99339\",\r\n \"resourceGroupName\": \"contoso-sharedServices\",\r\n \"resourceGroupId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-sharedServices\",\r\n \"virtualNetworkName\": \"sharedServices-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-sharedServices/providers/Microsoft.Network/virtualNetworks/sharedServices-vnet\",\r\n \"subnetName\": \"sharedServices-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-sharedServices/providers/Microsoft.Network/virtualNetworks/sharedServices-vnet/subnets/sharedServices-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.120.0/27\",\r\n \"networkSecurityGroupName\": \"sharedServices-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/093847b0-f0dd-428f-a0b0-bd4245b99339/resourceGroups/contoso-sharedServices/providers/Microsoft.Network/networkSecurityGroups/sharedServices-nsg\"\r\n }\r\n ]\r\n }\r\n}\r\n')]" - }, - "appServicePlanName": { - "type": "string", - "defaultValue": "[format('{0}-asp', parameters('mlzDeploymentVariables').mlzResourcePrefix.Value)]", - "metadata": { - "description": "The name of the web server farm which will be created. If unchanged or not specified, the MLZ resource prefix + \"--ASP\" will be utilized." - } - }, - "targetResourceGroup": { - "type": "string", - "defaultValue": "[format('{0}', parameters('mlzDeploymentVariables').spokes.Value[2].resourceGroupName)]", - "metadata": { - "description": "The name of the resource group in which the app service plan will be deployed. If unchanged or not specified, the MLZ shared services resource group is used." - } - }, - "enableAutoScale": { - "type": "bool", - "defaultValue": true, - "metadata": { - "description": "If true, enables dynamic scale-in & scale-out based on CPU percentages. If false, then compute instances remain static with 2 instances supporting all traffic" - } - } - }, - "functions": [], - "variables": { - "targetSubscriptionId_Var": "[if(equals(parameters('targetResourceGroup'), format('{0}', parameters('mlzDeploymentVariables').spokes.Value[2].resourceGroupName)), format('{0}', parameters('mlzDeploymentVariables').spokes.Value[2].subscriptionId), subscription().subscriptionId)]", - "location": "[deployment().location]", - "kind": "linux", - "capacity": 2, - "sku": "premium" - }, - "resources": [ - { - "type": "Microsoft.Resources/resourceGroups", - "apiVersion": "2020-10-01", - "name": "[parameters('targetResourceGroup')]", - "location": "[variables('location')]" - }, - { - "type": "Microsoft.Resources/deployments", - "apiVersion": "2020-06-01", - "name": "[parameters('appServicePlanName')]", - "subscriptionId": "[variables('targetSubscriptionId_Var')]", - "resourceGroup": "[parameters('targetResourceGroup')]", - "properties": { - "expressionEvaluationOptions": { - "scope": "inner" - }, - "mode": "Incremental", - "parameters": { - "location": { - "value": "[variables('location')]" - }, - "svcPlanName": { - "value": "[parameters('appServicePlanName')]" - }, - "sku": { - "value": "[variables('sku')]" - }, - "capacity": { - "value": "[variables('capacity')]" - }, - "kind": { - "value": "[variables('kind')]" - } - }, - "template": { - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.4.1008.15138", - "templateHash": "14684044973590456081" - } - }, - "parameters": { - "svcPlanName": { - "type": "string" - }, - "location": { - "type": "string" - }, - "capacity": { - "type": "int", - "defaultValue": 2 - }, - "kind": { - "type": "string" - }, - "sku": { - "type": "string" - }, - "svcPlanSize": { - "type": "string", - "defaultValue": "P2v2", - "metadata": { - "description": "The instance size of the app." - } - } - }, - "functions": [], - "variables": { - "reserved": "[if(equals(parameters('kind'), 'linux'), true(), false())]" - }, - "resources": [ - { - "type": "Microsoft.Web/serverfarms", - "apiVersion": "2020-12-01", - "name": "[parameters('svcPlanName')]", - "location": "[parameters('location')]", - "kind": "[parameters('kind')]", - "sku": { - "name": "[parameters('svcPlanSize')]", - "tier": "[parameters('sku')]", - "capacity": "[parameters('capacity')]" - }, - "properties": { - "reserved": "[variables('reserved')]" - } - } - ], - "outputs": { - "svcPlanName": { - "type": "string", - "value": "[parameters('svcPlanName')]" - }, - "svcPlanID": { - "type": "string", - "value": "[resourceId('Microsoft.Web/serverfarms', parameters('svcPlanName'))]" - } - } - } - }, - "dependsOn": [ - "[subscriptionResourceId('Microsoft.Resources/resourceGroups', parameters('targetResourceGroup'))]" - ] - }, - { - "condition": "[parameters('enableAutoScale')]", - "type": "Microsoft.Resources/deployments", - "apiVersion": "2020-06-01", - "name": "appServicePlanSettingsName", - "subscriptionId": "[variables('targetSubscriptionId_Var')]", - "resourceGroup": "[parameters('targetResourceGroup')]", - "properties": { - "expressionEvaluationOptions": { - "scope": "inner" - }, - "mode": "Incremental", - "parameters": { - "location": { - "value": "[variables('location')]" - }, - "svcPlanName": { - "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('targetSubscriptionId_Var'), parameters('targetResourceGroup')), 'Microsoft.Resources/deployments', parameters('appServicePlanName')), '2020-06-01').outputs.svcPlanName.value]" - }, - "svcPlanNameID": { - "value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('targetSubscriptionId_Var'), parameters('targetResourceGroup')), 'Microsoft.Resources/deployments', parameters('appServicePlanName')), '2020-06-01').outputs.svcPlanID.value]" - } - }, - "template": { - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.4.1008.15138", - "templateHash": "7636819529925623419" - } - }, - "parameters": { - "svcPlanName": { - "type": "string" - }, - "svcPlanNameID": { - "type": "string" - }, - "location": { - "type": "string" - }, - "minimumCapacity": { - "type": "int", - "defaultValue": 2, - "metadata": { - "description": "The minimum capacity. Autoscale engine will ensure the instance count is at least this value." - } - }, - "maximumCapacity": { - "type": "int", - "defaultValue": 10, - "metadata": { - "description": "The maximum capacity. Autoscale engine will ensure the instance count is not greater than this value." - } - }, - "defaultCapacity": { - "type": "int", - "defaultValue": 2, - "metadata": { - "description": "The default capacity. Autoscale engine will preventively set the instance count to be this value if it can not find any metric data." - } - }, - "metricName": { - "type": "string", - "defaultValue": "CpuPercentage", - "metadata": { - "description": "The metric name." - } - }, - "metricThresholdToScaleOut": { - "type": "int", - "defaultValue": 70, - "metadata": { - "description": "The metric upper threshold. If the metric value is above this threshold then autoscale engine will initiate scale out action." - } - }, - "metricThresholdToScaleIn": { - "type": "int", - "defaultValue": 30, - "metadata": { - "description": "The metric lower threshold. If the metric value is below this threshold then autoscale engine will initiate scale in action." - } - }, - "changePercentScaleOut": { - "type": "int", - "defaultValue": 20, - "metadata": { - "description": "The percentage to increase the instance count when autoscale engine is initiating scale out action." - } - }, - "changePercentScaleIn": { - "type": "int", - "defaultValue": 10, - "metadata": { - "description": "The percentage to decrease the instance count when autoscale engine is initiating scale in action." - } - }, - "autoscaleEnabled": { - "type": "bool", - "defaultValue": true, - "metadata": { - "description": "A boolean to indicate whether the autoscale policy is enabled or disabled." - } - } - }, - "functions": [], - "variables": { - "settingName_var": "[format('{0}-setting', toLower(parameters('svcPlanName')))]", - "targetResourceId": "[parameters('svcPlanNameID')]" - }, - "resources": [ - { - "type": "Microsoft.Insights/autoscalesettings", - "apiVersion": "2015-04-01", - "name": "[variables('settingName_var')]", - "location": "[parameters('location')]", - "properties": { - "profiles": [ - { - "name": "DefaultAutoscaleProfile", - "capacity": { - "minimum": "[string(parameters('minimumCapacity'))]", - "maximum": "[string(parameters('maximumCapacity'))]", - "default": "[string(parameters('defaultCapacity'))]" - }, - "rules": [ - { - "metricTrigger": { - "metricName": "[parameters('metricName')]", - "metricResourceUri": "[variables('targetResourceId')]", - "timeGrain": "PT5M", - "statistic": "Average", - "timeWindow": "PT10M", - "timeAggregation": "Average", - "operator": "GreaterThan", - "threshold": "[parameters('metricThresholdToScaleOut')]" - }, - "scaleAction": { - "direction": "Increase", - "type": "PercentChangeCount", - "value": "[string(parameters('changePercentScaleOut'))]", - "cooldown": "PT20M" - } - }, - { - "metricTrigger": { - "metricName": "[parameters('metricName')]", - "metricResourceUri": "[variables('targetResourceId')]", - "timeGrain": "PT5M", - "statistic": "Average", - "timeWindow": "PT10M", - "timeAggregation": "Average", - "operator": "LessThan", - "threshold": "[parameters('metricThresholdToScaleIn')]" - }, - "scaleAction": { - "direction": "Decrease", - "type": "PercentChangeCount", - "value": "[string(parameters('changePercentScaleIn'))]", - "cooldown": "PT20M" - } - } - ] - } - ], - "enabled": "[parameters('autoscaleEnabled')]", - "targetResourceUri": "[variables('targetResourceId')]" - } - } - ] - } - }, - "dependsOn": [ - "[extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('targetSubscriptionId_Var'), parameters('targetResourceGroup')), 'Microsoft.Resources/deployments', parameters('appServicePlanName'))]", - "[subscriptionResourceId('Microsoft.Resources/resourceGroups', parameters('targetResourceGroup'))]" - ] - } - ], - "outputs": { - "appServicePlanName": { - "type": "string", - "value": "[parameters('appServicePlanName')]" - }, - "resourceGroupName": { - "type": "string", - "value": "[parameters('targetResourceGroup')]" - } - } -} \ No newline at end of file diff --git a/src/bicep/examples/keyVault/azureKeyVault.json b/src/bicep/examples/keyVault/azureKeyVault.json deleted file mode 100644 index 096cce146..000000000 --- a/src/bicep/examples/keyVault/azureKeyVault.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.4.1008.15138", - "templateHash": "6558428922943348549" - } - }, - "parameters": { - "mlzDeploymentVariables": { - "type": "object", - "defaultValue": "[json('{\r\n \"mlzResourcePrefix\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"contoso\"\r\n },\r\n \"firewallPrivateIPAddress\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"10.0.100.4\"\r\n },\r\n \"hub\": {\r\n \"Type\": \"Object\",\r\n \"Value\": {\r\n \"subscriptionId\": \"ddf87969-a498-4676-a488-1932fbc5a306\",\r\n \"resourceGroupName\": \"contoso-hub\",\r\n \"resourceGroupResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-hub\",\r\n \"virtualNetworkName\": \"hub-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-hub/providers/Microsoft.Network/virtualNetworks/hub-vnet\",\r\n \"subnetName\": \"hub-vnet/hub-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-hub/providers/Microsoft.Network/virtualNetworks/hub-vnet/subnets/hub-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.100.128/27\",\r\n \"networkSecurityGroupName\": \"hub-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-hub/providers/Microsoft.Network/networkSecurityGroups/hub-nsg\"\r\n }\r\n },\r\n \"logAnalyticsWorkspaceName\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"contoso-laws\"\r\n },\r\n \"logAnalyticsWorkspaceResourceId\": {\r\n \"Type\": \"String\",\r\n \"Value\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-operations/providers/Microsoft.OperationalInsights/workspaces/contoso-laws\"\r\n },\r\n \"spokes\": {\r\n \"Type\": \"Array\",\r\n \"Value\": [\r\n {\r\n \"name\": \"operations\",\r\n \"subscriptionId\": \"ddf87969-a498-4676-a488-1932fbc5a306\",\r\n \"resourceGroupName\": \"contoso-operations\",\r\n \"resourceGroupId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-operations\",\r\n \"virtualNetworkName\": \"operations-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-operations/providers/Microsoft.Network/virtualNetworks/operations-vnet\",\r\n \"subnetName\": \"operations-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-operations/providers/Microsoft.Network/virtualNetworks/operations-vnet/subnets/operations-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.115.0/27\",\r\n \"networkSecurityGroupName\": \"operations-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-operations/providers/Microsoft.Network/networkSecurityGroups/operations-nsg\"\r\n },\r\n {\r\n \"name\": \"identity\",\r\n \"subscriptionId\": \"ddf87969-a498-4676-a488-1932fbc5a306\",\r\n \"resourceGroupName\": \"contoso-identity\",\r\n \"resourceGroupId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-identity\",\r\n \"virtualNetworkName\": \"identity-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-identity/providers/Microsoft.Network/virtualNetworks/identity-vnet\",\r\n \"subnetName\": \"identity-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-identity/providers/Microsoft.Network/virtualNetworks/identity-vnet/subnets/identity-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.110.0/27\",\r\n \"networkSecurityGroupName\": \"identity-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-identity/providers/Microsoft.Network/networkSecurityGroups/identity-nsg\"\r\n },\r\n {\r\n \"name\": \"sharedServices\",\r\n \"subscriptionId\": \"ddf87969-a498-4676-a488-1932fbc5a306\",\r\n \"resourceGroupName\": \"contoso-sharedServices\",\r\n \"resourceGroupId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-sharedServices\",\r\n \"virtualNetworkName\": \"sharedServices-vnet\",\r\n \"virtualNetworkResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-sharedServices/providers/Microsoft.Network/virtualNetworks/sharedServices-vnet\",\r\n \"subnetName\": \"sharedServices-subnet\",\r\n \"subnetResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-sharedServices/providers/Microsoft.Network/virtualNetworks/sharedServices-vnet/subnets/sharedServices-subnet\",\r\n \"subnetAddressPrefix\": \"10.0.120.0/27\",\r\n \"networkSecurityGroupName\": \"sharedServices-nsg\",\r\n \"networkSecurityGroupResourceId\": \"/subscriptions/ddf87969-a498-4676-a488-1932fbc5a306/resourceGroups/contoso-sharedServices/providers/Microsoft.Network/networkSecurityGroups/sharedServices-nsg\"\r\n }\r\n ]\r\n }\r\n}\r\n')]" - }, - "keyVaultName": { - "type": "string", - "defaultValue": "[format('{0}-akv', parameters('mlzDeploymentVariables').mlzResourcePrefix.Value)]", - "metadata": { - "description": "The name of the key vault which will be created. Must be clobally unique, between 3 and 24 characters and only single hyphens permitted. If unchanged or not specified, the MLZ resource prefix + \"-akv\" will be utilized." - } - }, - "targetResourceGroup": { - "type": "string", - "defaultValue": "[format('{0}', parameters('mlzDeploymentVariables').spokes.Value[2].resourceGroupName)]", - "metadata": { - "description": "The name of the resource group in which the key vault will be deployed. If unchanged or not specified, the MLZ shared services resource group is used." - } - } - }, - "functions": [], - "variables": { - "targetSubscriptionId_Var": "[if(equals(parameters('targetResourceGroup'), format('{0}', parameters('mlzDeploymentVariables').spokes.Value[2].resourceGroupName)), format('{0}', parameters('mlzDeploymentVariables').spokes.Value[2].subscriptionId), subscription().subscriptionId)]", - "location": "[deployment().location]" - }, - "resources": [ - { - "type": "Microsoft.Resources/resourceGroups", - "apiVersion": "2020-10-01", - "name": "[parameters('targetResourceGroup')]", - "location": "[variables('location')]" - }, - { - "type": "Microsoft.Resources/deployments", - "apiVersion": "2020-06-01", - "name": "[parameters('keyVaultName')]", - "subscriptionId": "[variables('targetSubscriptionId_Var')]", - "resourceGroup": "[parameters('targetResourceGroup')]", - "properties": { - "expressionEvaluationOptions": { - "scope": "inner" - }, - "mode": "Incremental", - "parameters": { - "keyVaultName": { - "value": "[parameters('keyVaultName')]" - }, - "tenantID": { - "value": "[subscription().tenantId]" - } - }, - "template": { - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "metadata": { - "_generator": { - "name": "bicep", - "version": "0.4.1008.15138", - "templateHash": "15112517158840559321" - } - }, - "parameters": { - "keyVaultName": { - "type": "string" - }, - "location": { - "type": "string", - "defaultValue": "[resourceGroup().location]" - }, - "tenantID": { - "type": "string" - } - }, - "functions": [], - "resources": [ - { - "type": "Microsoft.KeyVault/vaults", - "apiVersion": "2019-09-01", - "name": "[parameters('keyVaultName')]", - "location": "[parameters('location')]", - "properties": { - "sku": { - "family": "A", - "name": "premium" - }, - "tenantId": "[parameters('tenantID')]", - "enabledForDeployment": true, - "enabledForTemplateDeployment": true, - "enableSoftDelete": true, - "softDeleteRetentionInDays": 7, - "enableRbacAuthorization": true - } - } - ] - } - }, - "dependsOn": [ - "[subscriptionResourceId('Microsoft.Resources/resourceGroups', parameters('targetResourceGroup'))]" - ] - } - ], - "outputs": { - "azureKeyVaultName": { - "type": "string", - "value": "[parameters('keyVaultName')]" - }, - "resourceGroupName": { - "type": "string", - "value": "[parameters('targetResourceGroup')]" - } - } -} \ No newline at end of file