Azure StorageAccount minimum TLS1.2 support - azure

I use ARM to define my resources in Azure. Now i want to define the minimum supported TLS Version within my ARM Template for a StorageAccount.
Usually i just edit the resource via the dashboard and export the generated ARM Template to then look for the new change. Unfortunately for the TLS Version this does not seam to be a part of the ARM Template definition.
I also can not find any mention in the Schema definition -> https://github.com/Azure/azure-resource-manager-schemas/blob/master/schemas/2019-06-01/Microsoft.Storage.json
Does anyone know how i can for the minimum TLS Version to be no less than 1.2 during or directly after the resource deployment?

I just created a Storage account with tls 1.2 and i can see this in the template:
"minimumTlsVersion": "[parameters('minimumTlsVersion')]",
And the parameter value is:
"minimumTlsVersion": {
"value": "TLS1_2"
},
This is the full template
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"storageAccountName": {
"type": "string"
},
"accountType": {
"type": "string"
},
"kind": {
"type": "string"
},
"accessTier": {
"type": "string"
},
"minimumTlsVersion": {
"type": "string"
},
"supportsHttpsTrafficOnly": {
"type": "bool"
},
"allowBlobPublicAccess": {
"type": "bool"
},
"networkAclsBypass": {
"type": "string"
},
"networkAclsDefaultAction": {
"type": "string"
}
},
"variables": {},
"resources": [
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"location": "[parameters('location')]",
"properties": {
"accessTier": "[parameters('accessTier')]",
"minimumTlsVersion": "[parameters('minimumTlsVersion')]",
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]",
"allowBlobPublicAccess": "[parameters('allowBlobPublicAccess')]",
"networkAcls": {
"bypass": "[parameters('networkAclsBypass')]",
"defaultAction": "[parameters('networkAclsDefaultAction')]",
"ipRules": []
}
},
"dependsOn": [],
"sku": {
"name": "[parameters('accountType')]"
},
"kind": "[parameters('kind')]",
"tags": {}
}
],
"outputs": {}
}

Related

Default Values in ARM templates when using Template Specs

We have implemented Template Specs for our ARM deployments to Azure a while ago and we drastically decreased the amount of work by doing that. The next thing we're trying to achieve is to start implementing Default Values in template specs, so we do not have to specify all parameters that are the same in all our projects in the parameter files. In case we do want to override the default, we can of course specify the parameter in the parameter file.
We worked with this already in the past with templates and parameter files, but I can't get this to work with Template Specs.
As an example, I'm trying to deploy an App Service Plan like this:
Template Spec:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"type": "object",
"defaultValue": {
"isHypervContainerPlan": false
}
},
"resourceNameAndTagSettings": {
"type": "object"
}
},
"variables": {
"appServicePlanName": "[concat('o', parameters('appServicePlanSettings').nameAbbr, parameters('resourceNameAndTagSettings').environmentType, parameters('resourceNameAndTagSettings').resourceGroupNumber, parameters('resourceNameAndTagSettings').solutionNameAbbr, parameters('resourceNameAndTagSettings').locationAbbr)]"
},
"resources": [
{
"comments": "App Service Plans",
"condition": "[parameters('appServicePlanSettings').deploy]",
"apiVersion": "2020-09-01",
"type": "Microsoft.Web/serverfarms",
"name": "[variables('appServicePlanName')]",
"location": "[resourceGroup().location]",
"tags": {
"_Purpose": "[parameters('appServicePlanSettings').tagValuePurpose]",
"CostCenter": "[parameters('resourceNameAndTagSettings').tagValueCostCenter]",
"EnvironmentType": "[parameters('resourceNameAndTagSettings').tagValueEnvironmentType]",
"Owner": "[parameters('resourceNameAndTagSettings').tagValueOwner]"
},
"kind": "[parameters('appServicePlanSettings').kind]",
"sku": {
"name": "[parameters('appServicePlanSettings').sku]",
"size": "[parameters('appServicePlanSettings').sku]",
"tier": "[parameters('appServicePlanSettings').skuTier]"
},
"properties": {
"hyperV": "[parameters('appServicePlanSettings').isHypervContainerPlan]",
"perSiteScaling": "[parameters('appServicePlanSettings').perSiteScaling]",
"reserved": "[parameters('appServicePlanSettings').isLinuxOS]"
},
"dependsOn": []
}
],
"outputs": {}
}
Main Template:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"type": "array"
},
"dateTime": {
"type": "string",
"defaultValue": "[utcNow()]"
},
"resourceNameAndTagSettings": {
"type": "object"
},
"templateSpecSettings": {
"type": "object"
}
},
"resources": [
{
"comments": "Apps - App Service Plans",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-06-01",
"name": "[concat('Deploy-', parameters('appServicePlanSettings')[copyIndex()].nameAbbr, parameters('resourceNameAndTagSettings').environmentType, parameters('resourceNameAndTagSettings').resourceGroupNumber, parameters('resourceNameAndTagSettings').solutionNameAbbr, parameters('resourceNameAndTagSettings').locationAbbr, '-', parameters('dateTime'))]",
"copy": {
"name": "appServicePlanCopy",
"count": "[length(parameters('appServicePlanSettings'))]"
},
"properties": {
"mode": "Incremental",
"templateLink": {
"id": "[concat('/subscriptions/', parameters('templateSpecSettings').templateSpecSubscriptionId, '/resourceGroups/', parameters('templateSpecSettings').templateSpecResourceGroupName, '/providers/Microsoft.Resources/TemplateSpecs/', parameters('templateSpecSettings').appServicePlan.name, '/versions/', parameters('templateSpecSettings').appServicePlan.version)]"
},
"parameters": {
"appServicePlanSettings": {
"value": "[parameters('appServicePlanSettings')[copyIndex()]]"
},
"resourceNameAndTagSettings": {
"value": "[parameters('resourceNameAndTagSettings')]"
}
}
},
"dependsOn": []
}
],
"outputs": {}
}
Parameter File:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"value": [
{
"comments": "App Service Plan 1",
"deploy": true,
"nameAbbr": "Asp",
"isLinuxOS": false,
"isHypervContainerPlan": false,
"perSiteScaling": false,
"tagValuePurpose": "Test",
"kind": "app",
"sku": "P1v2",
"skuTier": "PremiumV2"
}
]
},
"resourceNameAndTagSettings": {
"value": {
"environmentType": "dev",
"locationAbbr": "europe",
"resourceGroupNumber": "001",
"solutionNameAbbr": "test",
"tagValueCostCenter": "123",
"tagValueEnvironmentType": "Development",
"tagValueOwner": "me"
}
},
"templateSpecSettings": {
"value": {
"templateSpecResourceGroupName": "XXX",
"templateSpecSubscriptionId": "XXX",
"appServicePlan": {
"name": "appServicePlanTest",
"version": "1.2"
}
}
}
}
}
This deploys just fine.
But if I leave out:
"isHypervContainerPlan": false,
in the parameter file, the deployment will fail with this message:
Unable to process template language expressions for resource '...' at
line '24' and column '9'. 'The language expression property
'isHypervContainerPlan' doesn't exist, available properties are
'comments, deploy, nameAbbr, isLinuxOS, perSiteScaling,
tagValuePurpose, kind, sku, skuTier'.
Why would it fail on this error if the defaultValue is set in the Template Spec parameters section?
What am I missing here or are defaultValues not supported with Template Specs?
A defaultValue on a parameter is only used if no value is supplied. Put another way, you can you either use the defaultValue for a parameter or supply a value, not both, nor any combination of the two.
Your templateSpec expects a complex object for the appServicePlanSettings parameter. That object needs to have all of the properties referenced by the serverFarm resource being deployed. You're supplying a value for that param, but you're also omitting one of the properties from that parameter, and that's the property that's being flagged in the error message.
To see this in action in another way, put that property back into your param file and remove a different one, you'll see a similar error... or you could just not supply a param value at all for the ``appServicePlanSettings``` and then the defaultValue will be used.
I've been testing with the 'defaultValue'.
I have also tested with this setup:
Template:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"type": "object",
"defaultValue": {
"isHypervContainerPlan": false,
"isLinuxOS": false,
"perSiteScaling": false
}
},
"resourceNameAndTagSettings": {
"type": "object"
}
},
"variables": {
"appServicePlanName": "[concat('o', parameters('appServicePlanSettings').nameAbbr, parameters('resourceNameAndTagSettings').environmentType, parameters('resourceNameAndTagSettings').resourceGroupNumber, parameters('resourceNameAndTagSettings').solutionNameAbbr, parameters('resourceNameAndTagSettings').locationAbbr)]"
},
"resources": [
{
"comments": "App Service Plans",
"condition": "[parameters('appServicePlanSettings').deploy]",
"apiVersion": "2020-09-01",
"type": "Microsoft.Web/serverfarms",
"name": "[variables('appServicePlanName')]",
"location": "[resourceGroup().location]",
"tags": {
"_Purpose": "[parameters('appServicePlanSettings').tagValuePurpose]",
"CostCenter": "[parameters('resourceNameAndTagSettings').tagValueCostCenter]",
"EnvironmentType": "[parameters('resourceNameAndTagSettings').tagValueEnvironmentType]",
"Owner": "[parameters('resourceNameAndTagSettings').tagValueOwner]"
},
"kind": "[parameters('appServicePlanSettings').kind]",
"sku": {
"name": "[parameters('appServicePlanSettings').sku]",
"size": "[parameters('appServicePlanSettings').sku]",
"tier": "[parameters('appServicePlanSettings').skuTier]"
},
"properties": {
"hyperV": "[parameters('appServicePlanSettings').isHypervContainerPlan]",
"perSiteScaling": "[parameters('appServicePlanSettings').perSiteScaling]",
"reserved": "[parameters('appServicePlanSettings').isLinuxOS]"
},
"dependsOn": []
}
],
"outputs": {}
}
Parameters:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"value": {
"comments": "App Service Plan 1",
"deploy": true,
"nameAbbr": "Asp",
"isLinuxOS": "",
"isHypervContainerPlan": "",
"perSiteScaling": "",
"tagValuePurpose": "Test",
"kind": "app",
"sku": "P1v2",
"skuTier": "PremiumV2"
}
},
"resourceNameAndTagSettings": {
"value": {
"environmentType": "dev",
"locationAbbr": "europe",
"resourceGroupNumber": "001",
"solutionNameAbbr": "test",
"tagValueCostCenter": "123",
"tagValueEnvironmentType": "Development",
"tagValueOwner": "me"
}
},
"templateSpecSettings": {
"value": {
"templateSpecResourceGroupName": "oGen1Weu1PrdMng001",
"templateSpecSubscriptionId": "130176f8-513a-4869-9db3-7c46d0e25159",
"appServicePlan": {
"name": "appServicePlanTest",
"version": "1.2"
}
}
}
}
}
Which also doesn't work when I do not specify "isHypervContainerPlan" in the parameter file, I thought we tested this, but apparently not good enough...
The only thing that works is defining:
"isHypervContainerPlan": "",
in the parameter file, thus not specifying a value. Which is not desirable, because then still all parameters have to be defined, even when I do not want to override the defaults.
So, the solution in the end has become the following (the main template remains the same):
Template Spec:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"type": "object"
},
"resourceNameAndTagSettings": {
"type": "object"
}
},
"variables": {
"appServicePlanName": "[concat('o', parameters('appServicePlanSettings').nameAbbr, parameters('resourceNameAndTagSettings').environmentType, parameters('resourceNameAndTagSettings').resourceGroupNumber, parameters('resourceNameAndTagSettings').solutionNameAbbr, parameters('resourceNameAndTagSettings').locationAbbr)]",
"appServicePlanSettings": {
"isHypervContainerPlan": false,
"isLinuxOS": false,
"kind": "app",
"nameAbbr": "Asp",
"perSiteScaling": false
}
},
"resources": [
{
"comments": "App Service Plans",
"condition": "[parameters('appServicePlanSettings').deploy]",
"apiVersion": "2020-09-01",
"type": "Microsoft.Web/serverfarms",
"name": "[variables('appServicePlanName')]",
"location": "[resourceGroup().location]",
"tags": {
"_Purpose": "[parameters('appServicePlanSettings').tagValuePurpose]",
"CostCenter": "[parameters('resourceNameAndTagSettings').tagValueCostCenter]",
"EnvironmentType": "[parameters('resourceNameAndTagSettings').tagValueEnvironmentType]",
"Owner": "[parameters('resourceNameAndTagSettings').tagValueOwner]"
},
"kind": "[if(contains(parameters('appServicePlanSettings'), 'kind'), parameters('appServicePlanSettings').kind, variables('appServicePlanSettings').kind)]",
"sku": {
"name": "[parameters('appServicePlanSettings').sku]",
"size": "[parameters('appServicePlanSettings').sku]",
"tier": "[parameters('appServicePlanSettings').skuTier]"
},
"properties": {
"hyperV": "[if(contains(parameters('appServicePlanSettings'), 'isHypervContainerPlan'), parameters('appServicePlanSettings').isHypervContainerPlan, variables('appServicePlanSettings').isHypervContainerPlan)]",
"perSiteScaling": "[if(contains(parameters('appServicePlanSettings'), 'perSiteScaling'), parameters('appServicePlanSettings').perSiteScaling, variables('appServicePlanSettings').perSiteScaling)]",
"reserved": "[if(contains(parameters('appServicePlanSettings'), 'isLinuxOS'), parameters('appServicePlanSettings').isLinuxOS, variables('appServicePlanSettings').isLinuxOS)]"
},
"dependsOn": []
}
],
"outputs": {}
}
And if I don't specify these values now in the parameter file, the value configured in the variable section will be used:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appServicePlanSettings": {
"value": [
{
"comments": "App Service Plan 1",
"deploy": true,
"nameAbbr": "Asp",
"tagValuePurpose": "Test",
"kind": "app",
"sku": "P1v2",
"skuTier": "PremiumV2"
}
]
},
"resourceNameAndTagSettings": {
"value": {
"environmentType": "dev",
"locationAbbr": "europe",
"resourceGroupNumber": "001",
"solutionNameAbbr": "test",
"tagValueCostCenter": "123",
"tagValueEnvironmentType": "Development",
"tagValueOwner": "me"
}
},
"templateSpecSettings": {
"value": {
"templateSpecResourceGroupName": "XXX",
"templateSpecSubscriptionId": "XXX",
"appServicePlan": {
"name": "appServicePlanTest",
"version": "1.2"
}
}
}
}
}

How to tag Current time as a Tag for an ARM Deployment

I am trying to create a Log Analytics Workspace using an ARM template and a parameter files. I am also thinking to tag currrent time as CreatedOn tag for the resource.
Below is my ARM template-
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"LAWName": {
"type": "string"
},
"LocationName": {
"type": "string"
},
"SKUName": {
"type": "string"
},
"Tags": {
"type": "object"
}
},
"resources": [
{
"apiVersion": "2017-03-15-preview",
"name": "[parameters('LAWName')]",
"location": "[parameters('LocationName')]",
"tags": "[parameters('Tags')]",
"type": "Microsoft.OperationalInsights/workspaces",
"properties": {
"sku": {
"name": "[parameters('SKUName')]"
}
}
}
]
}
and here is my param file-
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"LAWName": {
"value": "atifmtest1"
},
"LocationName": {
"value": "westeurope"
},
"SKUName": {
"value": "pergb2018"
}
"Tags": {
"value": {
"CreatedBy": "Atif",
"CreatedOn": "[utcNow()]",
"Purpose": "Monitoring"
}
}
}
}
I read here https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-date#utcnow that there is utcNow() function for ARM template but that is being considered as a string here and the current time does not appear as a tag for the resource.
What is the other way using which this can be achieved ?
Thanks in advance !!
Here is a working example:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"utcShort": {
"type": "string",
"defaultValue": "[utcNow('d')]"
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"resources": [
{
"apiVersion": "2019-04-01",
"type": "Microsoft.Storage/storageAccounts",
"name": "[concat('storage', uniqueString(resourceGroup().id))]",
"location": "[parameters('location')]",
"tags": {
"Dept": "Finance",
"Environment": "Production",
"LastDeployed": "[parameters('utcShort')]"
},
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"properties": {}
}
]
}
Source.
Please follow the below steps for better results.
Add the utcShort in parameters and give a default value "[utcNow()]", Its not work from the parameters file. add utcShort into variables to make an object type. Follow the below steps.
"utcShort ": {
"type": "string",
"defaultValue": "[utcNow()]"
},
"resourceTags": {
"type": "object"
}
},
"variables":{
"createdDate": {
"createdDate": "[parameters('utcShort ')]"
}
},
Use this variable in Tags like below..
"tags": "[union(parameters('resourceTags'), variables('createdDate'))]"

Azure ARM Template

Need you Help on something really quick :
How to set storage account "soft delete" option enabled using arm template?
2.What's the property that I should be using in arm template. Tried browsing through this site but couldn't get muchinformation - https://learn.microsoft.com/en-us/rest/api/storagerp/storageaccounts/getproperties
Any help is Much Appreciated.
Rocky
It seems that with the release of the 2018-11-01 version of the storage template it's now possible to enable soft delete in your ARM template.
Below you can find the template I've used:
{
"parameters": {
"NameForResources": {
"type": "string",
},
"ResourceLocation": {
"type": "string",
"defaultValue": "westeurope"
},
"Storage_Type": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS"
],
"metadata": {
"description": "Storage Account type"
}
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "[parameters('Storage_Type')]"
},
"kind": "Storage",
"name": "[parameters('NameForResources')]",
"apiVersion": "2018-11-01",
"location": "[parameters('ResourceLocation')]",
"properties": {
"encryption": {
"services": {
"blob": {
"enabled": true
},
"file": {
"enabled": true
}
},
"keySource": "Microsoft.Storage"
},
"supportsHttpsTrafficOnly": true
},
"resources": [
{
"name": "[concat(parameters('NameForResources'),'/','default')]",
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2018-11-01",
"properties": {
"deleteRetentionPolicy": {
"enabled": true,
"days": 30
}
},
"dependsOn": ["[concat('Microsoft.Storage/storageAccounts/', parameters('NameForResources'))]"]
}
]
}
],
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0"
}
I do not think it is currently possible to configure soft delete using ARM. Soft delete is a blob service property, not a property of the storage account.
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-soft-delete#powershell
For keyvaults, use "enableSoftDelete": true.
For storage accounts, add a blob service with 1) the following properties and 2) a dependsOn condition on the storage account:
{
"name": "[concat(parameters('storageAccountName'), '/default')]",
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2018-07-01",
"properties": {
"deleteRetentionPolicy": {
"enabled": true,
"days": 30
}
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
]
}

How to print output of linked template using ARM template in Azure

I am using maintemplate and linked template for deployment. I want to print the output of linked template after deployment.
When I deploy the below template. I am getting the below error,
The template output 'vmpublicIPName' is not valid: The language
expression property 'publicIPName' doesn't exist, available properties
are ''.. (Code: DeploymentOutputEvaluationFailed)
How can I print the output of variables present in linked template?
Is there any way to print all the linked template deployment parameters values in main template?
storage.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string"
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS"
}
},
"variables": {
"location": "[resourceGroup().location]",
"resourceGroupName": "[resourceGroup().name]",
"subscriptionId": "[subscription().subscriptionId]"
},
"resources": [
{
"name": "[concat(parameters('storageAccountName'), '1rmtest')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2015-06-15",
"location": "[variables('location')]",
"properties": {
"accountType": "[parameters('storageAccountType')]"
},
"tags": {
"BuildName": "StorageARM"
}
},
{
"apiVersion": "2017-03-01",
"name": "TestTemplate",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "incremental",
"templateLink": {
"uri":"https://gist.githubusercontent.com/public-ip-template.json",
"contentVersion":"1.0.0.0"
},
"parameters": {
"publicIpAddressName": {
"value": "public-ip-test"
}
}
}
}
],
"outputs": {
"vmpublicIPName": {
"type": "object",
"value": "[reference('TestTemplate').outputs.publicIPName]"
},
"vmlocation": {
"type": "object",
"value": "[reference('TestTemplate').outputs.location]"
}
}
}
Linked template:-
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"publicIpAddressName": {
"type": "string"
}
},
"variables": {
"location": "[resourceGroup().location]",
"resourceGroupName": "[resourceGroup().name]"
},
"resources": [
{
"name": "[parameters('publicIpAddressName')]",
"type": "Microsoft.Network/publicIpAddresses",
"apiVersion": "2016-09-01",
"location": "[variables('location')]",
"properties": {
"publicIpAllocationMethod": "Static"
}
}
],
"outputs": {
"publicIPName": {
"type": "string",
"value": "[parameters('publicIpAddressName')]"
},
"location": {
"type": "string",
"value": "[variables('location')]"
}
}
}
Do you ensure your linked template URI is correct and accessible? According to this official document
The URI value for the linked parameter file cannot be a local file,
and must include either http or https.
I test in my lab, I only replace your URI such as below:
"templateLink": {
"uri":"https://gist.githubusercontent.com/Walter-Shui/d5387c0fc92f2e8df1c7157a2d5e54aa/raw/722d4a58107b2f617996ae237ceae445ef4342d9/test.json",
"contentVersion":"1.0.0.0"
},
Your template works for me.
How can I print the output of variables present in linked template?
Yes, this is possible. Just like your template.
Is there any way to print all the linked template deployment
parameters values in main template?
You could use Azure cli 2.0 to get linked parameter values.
az group deployment create --name shuitest1 --resource-group shuitest --template-file test.json --parameters '{"storageAccountName":{"value":"shuitest"}}'
{
"id": "/subscriptions/********/resourceGroups/shuitest/providers/Microsoft.Resources/deployments/shuitest1",
"name": "shuitest1",
"properties": {
"correlationId": "dbe16f35-0807-4627-b4b5-86c0a25c49ba",
"debugSetting": null,
"dependencies": [],
"mode": "Incremental",
"outputs": {
"vmlocation": {
"type": "Object",
"value": {
"type": "String",
"value": "centralus"
}
},
"vmpublicIPName": {
"type": "Object",
"value": {
"type": "String",
"value": "public-ip-test"
}
}
},
"parameters": {
"storageAccountName": {
"type": "String",
"value": "shuitest"
},
"storageAccountType": {
"type": "String",
"value": "Standard_LRS"
}
},
"parametersLink": null,
"providers": [
{
"id": null,
"namespace": "Microsoft.Storage",
"registrationState": null,
"resourceTypes": [
{
"aliases": null,
"apiVersions": null,
"locations": [
"centralus"
],
"properties": null,
"resourceType": "storageAccounts"
}
]
},
{
"id": null,
"namespace": "Microsoft.Resources",
"registrationState": null,
"resourceTypes": [
{
"aliases": null,
"apiVersions": null,
"locations": [
null
],
"properties": null,
"resourceType": "deployments"
}
]
}
],
"provisioningState": "Succeeded",
"template": null,
"templateLink": null,
"timestamp": "2017-04-19T02:09:55.064156+00:00"
},
"resourceGroup": "shuitest"
}
"someName": {
"type": "string",
"value": "[variables('somevar')]"
},
The same way you are outputting parameters.
No there is no way of doing that.
So what is the question, your template looks good. I've tested it and it works
ps. the link on your template is wrong, that's the only thing that doesn't work

Tags Not Being Deployed to Server Farm with Azure ARM template

EDIT 11/15/2016: This was a bug in Azure which was fixed a couple of days ago.
Original post:
I'm trying to create several app services which depend on a server farm. I'm using an ARM template to deploy it. I'm using the same tags and tag format on every other resource in the template and they are getting created, but for some reason the tags on the server farm aren't. I can create the tags on the server farm through the Azure Portal and the Resource Explorer, but not through the ARM template.
Here's part of my resources section:
{
"comments": "",
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "S3",
"tier": "Standard",
"size": "S3",
"family": "S",
"capacity": 1
},
"tags": {
"tag1": "[parameters('tag1Value')]",
"tag2": "[parameters('tag2Value')]",
"tag3": "[parameters('tag3Value')]",
"tag4": "[parameters('tag4Value')]",
"tag5": "[parameters('tag4Value')]",
"tag6": "[parameters('tag6Value')]",
"tag7": "[parameters('tag7Value')]"
},
"name": "[variables('serverFarmName')]",
"apiVersion": "2015-08-01",
"location": "[parameters('location')]",
"properties": {
"name": "[variables('serverFarmName')]",
"numberOfWorkers": 1
},
"dependsOn": []
},
[...]
Any known issues with this? Do I have the tags in the wrong place?
Edit 8/8/2016:
Deploying just a server farm works correctly, but as soon as I add a site to that server farm the tags aren't deployed correctly. Here's what happens: Deployment starts, the server farm is created. Before the site is created I can rush into the Azure portal and see the tags created correctly on the server farm. As soon as the site is created I refresh, go back into the server farm, and the tags have disappeared.
It works fine on my side, you can try to leverage the Azure Resource Group project in Visual studio as mentioned at https://blogs.msdn.microsoft.com/kaevans/2015/11/22/creating-arm-templates-with-azure-resource-explorer/.
Here is my simple test template for your information:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"tag1Value": { "type": "string" },
"tag2Value": { "type": "string" },
"tag3Value": { "type": "string" },
"tag4Value": { "type": "string" },
"tag5Value": { "type": "string" },
"tag6Value": { "type": "string" },
"tag7Value": { "type": "string" },
"garysfName": {
"type": "string",
"minLength": 1
},
"garysfSKU": {
"type": "string",
"allowedValues": [
"Free",
"Shared",
"Basic",
"Standard"
],
"defaultValue": "Free"
},
"garysfWorkerSize": {
"type": "string",
"allowedValues": [
"0",
"1",
"2"
],
"defaultValue": "0"
}
},
"variables": {
},
"resources": [
{
"name": "[parameters('garysfName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"apiVersion": "2014-06-01",
"dependsOn": [ ],
"tags": {
"displayName": "garysf",
"tag1": "[parameters('tag1Value')]",
"tag2": "[parameters('tag2Value')]",
"tag3": "[parameters('tag3Value')]",
"tag4": "[parameters('tag4Value')]",
"tag5": "[parameters('tag4Value')]",
"tag6": "[parameters('tag6Value')]",
"tag7": "[parameters('tag7Value')]"
},
"properties": {
"name": "[parameters('garysfName')]",
"sku": "[parameters('garysfSKU')]",
"workerSize": "[parameters('garysfWorkerSize')]",
"numberOfWorkers": 1
}
},
{
"name": "[variables('garyarmwebappName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('garysfName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('garysfName'))]": "Resource",
"displayName": "garyarmwebapp"
},
"properties": {
"name": "[variables('garyarmwebappName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', parameters('garysfName'))]"
}
}
],
"outputs": {
}
}
And the parameters JSON file:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"tag1Value": { "value": "tag11" },
"tag2Value": { "value": "tag22" },
"tag3Value": { "value": "tag33" },
"tag4Value": { "value": "tag44" },
"tag5Value": { "value": "tag55" },
"tag6Value": { "value": "tag66" },
"tag7Value": { "value": "tag77" },
"garysfName": {
"value": "garyserverfarms"
}
}
}
And you can refer to https://ms.portal.azure.com/?flight=1&flight.browsegrid2=true&flight.pov2=true&flight.resourcemenuperf=true#blade/HubsExtension/SubscriptionTagsListBlade to check the tag list on Azure portal.

Resources