You are getting below errors while deploying resources to Azure using ARM template via Visual Studio 2017.
1. Cannot retrieve the dynamic parameters for the cmdlet. An item with the same key has already been added.
>>> Check the azuredeploy.json file, you probably have define the parameters twice. Example
—————————————————-
“existingVirtualNetworkName”: {
“type”: “string”,
“metadata”: {
“description”: “Name of the existing VNET”
}
}
—————————————————
and again defined it as below
——————————————————
“existingvirtualnetworkname”: {
“type”: “string”,
“metadata”: {
“description”: “Name of the existing VNET”
}
}
——————————————————-
Both the above are considered as same parameter. Removing one of them will fix the problem.
2. New-AzureRmResourceGroupDeployment : 9 Error: Code=VnetAddressPrefixesIsNullOrEmpty; Message=AddressSpace of the virtual network /subscriptions/fa6284509d932bbd/resourceGroups/Test/providers/Microsoft.Network/virtualNetworks/vnet01qadh does not have any address prefixes in addressPrefixes array. AddressSpace and prefixes must be specified within properties object.
>>>>Make sure address prefixes for the Virtual network is defined as array and not string.
If defined like below it will throw the error-
——————————————————–
“addressPrefixes”: {
“type”: “string”,
“defaultValue”: “10.0.0.0/16” ,
“metadata”: {
“description”: “Address prefix of the virtual network”
}
}
——————————————————-
Correct way is
—————————————————–
“addressPrefixes”: {
“type”: “array”,
“defaultValue”: [“10.0.0.0/16”] ,
“metadata”: {
“description”: “Address prefix of the virtual network”
}
}
—————————————————–