Reputation: 1
Hi When I try to deploy storage Account after creating azuredeploy.json and azuredeploy.parameter.json using VS code I am getting the below error message
"cli.azure.cli.core.azclierror: Unable to parse parameter: azuredeploy.parameters.json az_command_data_logger: Unable to parse parameter: azuredeploy.parameters.json"
I used
az deployment group create --resource-group az204-arm-rg --template-file D:\Azure\azuredeploy.json --parameters azuredeploy.parameter
command in the terminal.
azuredeploy.json file has
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage Account Name",
"minLength": 3,
"maxLength": 24
},
}},
"functions": [],
"variables": {},
"resources": [{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-04-01",
"tags": {
"displayName": "storageaccount1"
},
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
}
}],
"outputs":{}
}
azuredeploy.parameters.json has
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"value": "az204storageacctarm" // TODO: Fill in parameter value
}
}
}
Error :-
Upvotes: 0
Views: 4243
Reputation: 4893
I used az deployment group create --resource-group az204-arm-rg --template-file D:\Azure\azuredeploy.json --parameters azuredeploy.parameter command in the terminal
It seems you have already filled all required parameters in your azuredeploy.parameter.json
file .
The command you are trying to use by without providing parameter file path , try to use the below suggested command to deploy with parameter file by giving the path of parameter file.
e.g:-
az deployment group create -n TestDeployment -g resourcegroup --template-file "C:\Users\source\repos\yourtemplatearm.json" --parameters "C:\users\source\repos\azuredeploy.parameters.json"
NOTE:- Before deploy template make sure that you have logged in using az login
Below are steps:-
Default template that we tried to use and deploy .
storagetest.json
-
{
"$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"
},
"publicNetworkAccess": {
"type": "string"
},
"allowBlobPublicAccess": {
"type": "bool"
},
"allowSharedKeyAccess": {
"type": "bool"
},
"allowCrossTenantReplication": {
"type": "bool"
},
"defaultOAuth": {
"type": "bool"
},
"networkAclsBypass": {
"type": "string"
},
"networkAclsDefaultAction": {
"type": "string"
},
"dnsEndpointType": {
"type": "string"
},
"keySource": {
"type": "string"
},
"encryptionEnabled": {
"type": "bool"
},
"keyTypeForTableAndQueueEncryption": {
"type": "string"
},
"infrastructureEncryptionEnabled": {
"type": "bool"
},
"isContainerRestoreEnabled": {
"type": "bool"
},
"isBlobSoftDeleteEnabled": {
"type": "bool"
},
"blobSoftDeleteRetentionDays": {
"type": "int"
},
"isContainerSoftDeleteEnabled": {
"type": "bool"
},
"containerSoftDeleteRetentionDays": {
"type": "int"
},
"changeFeed": {
"type": "bool"
},
"isVersioningEnabled": {
"type": "bool"
},
"isShareSoftDeleteEnabled": {
"type": "bool"
},
"shareSoftDeleteRetentionDays": {
"type": "int"
}
},
"variables": {},
"resources": [
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2021-09-01",
"location": "[parameters('location')]",
"properties": {
"accessTier": "[parameters('accessTier')]",
"minimumTlsVersion": "[parameters('minimumTlsVersion')]",
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]",
"publicNetworkAccess": "[parameters('publicNetworkAccess')]",
"allowBlobPublicAccess": "[parameters('allowBlobPublicAccess')]",
"allowSharedKeyAccess": "[parameters('allowSharedKeyAccess')]",
"allowCrossTenantReplication": "[parameters('allowCrossTenantReplication')]",
"defaultToOAuthAuthentication": "[parameters('defaultOAuth')]",
"networkAcls": {
"bypass": "[parameters('networkAclsBypass')]",
"defaultAction": "[parameters('networkAclsDefaultAction')]",
"ipRules": []
},
"dnsEndpointType": "[parameters('dnsEndpointType')]",
"encryption": {
"keySource": "[parameters('keySource')]",
"services": {
"blob": {
"enabled": "[parameters('encryptionEnabled')]"
},
"file": {
"enabled": "[parameters('encryptionEnabled')]"
},
"table": {
"enabled": "[parameters('encryptionEnabled')]"
},
"queue": {
"enabled": "[parameters('encryptionEnabled')]"
}
},
"requireInfrastructureEncryption": "[parameters('infrastructureEncryptionEnabled')]"
}
},
"dependsOn": [],
"sku": {
"name": "[parameters('accountType')]"
},
"kind": "[parameters('kind')]",
"tags": {}
},
{
"name": "[concat(parameters('storageAccountName'), '/default')]",
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2021-09-01",
"properties": {
"restorePolicy": {
"enabled": "[parameters('isContainerRestoreEnabled')]"
},
"deleteRetentionPolicy": {
"enabled": "[parameters('isBlobSoftDeleteEnabled')]",
"days": "[parameters('blobSoftDeleteRetentionDays')]"
},
"containerDeleteRetentionPolicy": {
"enabled": "[parameters('isContainerSoftDeleteEnabled')]",
"days": "[parameters('containerSoftDeleteRetentionDays')]"
},
"changeFeed": {
"enabled": "[parameters('changeFeed')]"
},
"isVersioningEnabled": "[parameters('isVersioningEnabled')]"
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
]
},
{
"name": "[concat(parameters('storageAccountName'), '/default')]",
"type": "Microsoft.Storage/storageAccounts/fileservices",
"apiVersion": "2021-09-01",
"properties": {
"shareDeleteRetentionPolicy": {
"enabled": "[parameters('isShareSoftDeleteEnabled')]",
"days": "[parameters('shareSoftDeleteRetentionDays')]"
}
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
"[concat(concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName')), '/blobServices/default')]"
]
}
],
"outputs": {}
}
azuredeploy.parameter.json
-
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"value": "eastus"
},
"storageAccountName": {
"value": "yourstorageaccountname"
},
"accountType": {
"value": "Standard_RAGRS"
},
"kind": {
"value": "StorageV2"
},
"accessTier": {
"value": "Hot"
},
"minimumTlsVersion": {
"value": "TLS1_2"
},
"supportsHttpsTrafficOnly": {
"value": true
},
"publicNetworkAccess": {
"value": "Enabled"
},
"allowBlobPublicAccess": {
"value": true
},
"allowSharedKeyAccess": {
"value": true
},
"allowCrossTenantReplication": {
"value": true
},
"defaultOAuth": {
"value": false
},
"networkAclsBypass": {
"value": "AzureServices"
},
"networkAclsDefaultAction": {
"value": "Allow"
},
"dnsEndpointType": {
"value": "Standard"
},
"keySource": {
"value": "Microsoft.Storage"
},
"encryptionEnabled": {
"value": true
},
"keyTypeForTableAndQueueEncryption": {
"value": "Account"
},
"infrastructureEncryptionEnabled": {
"value": false
},
"isContainerRestoreEnabled": {
"value": false
},
"isBlobSoftDeleteEnabled": {
"value": true
},
"blobSoftDeleteRetentionDays": {
"value": 7
},
"isContainerSoftDeleteEnabled": {
"value": true
},
"containerSoftDeleteRetentionDays": {
"value": 7
},
"changeFeed": {
"value": false
},
"isVersioningEnabled": {
"value": false
},
"isShareSoftDeleteEnabled": {
"value": true
},
"shareSoftDeleteRetentionDays": {
"value": 7
}
}
}
SCREENSHOT FOR REFERENCE:-
For more information please refer this MICROSOFT DOCUMENTATION.
Upvotes: 1