Exercise - Add parameters and outputs to your Azure Resource Manager template - Failing | A parameter cannot be found that matches parameter name 'storageSKU'.

Amardeep Bhamra 20 Reputation points
2023-11-29T18:06:08.8933333+00:00

PS /Users/Amar> New-AzResourceGroupDeployment `
>>   -Name $deploymentName `
>>   -TemplateFile $templateFile `
>>   -storageName storageName12369 `
>>   -storageSKU Standard_LRS
New-AzResourceGroupDeployment: 
Line |
   5 |    -storageSKU Standard_LRS
     |    ~~~~~~~~~~~
     | A parameter cannot be found that matches parameter name 'storageSKU'.


{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "storageName": {
      "type": "string",
      "minLength": 3,
      "maxLength": 24,
      "metadata": {
        "description": "The name of the Azure storage resource"
      }
    },
    "storageSKU": {
      "type": "string",
      "defaultValue": "Standard_LRS",
      "allowedValues": [
        "Standard_LRS",
        "Standard_GRS",
        "Standard_RAGRS",
        "Standard_ZRS",
        "Premium_LRS",
        "Premium_ZRS",
        "Standard_GZRS",
        "Standard_RAGZRS"
      ]
    }
  },
  "functions": [],
  "variables": {},
  "resources": [
    {
      "name": "[parameters('storageName')]",
      "type": "Microsoft.Storage/storageAccounts",
      "apiVersion": "2019-06-01",
      "tags": {
        "displayName": "[parameters('storageName')]"
      },
      "location": "[resourceGroup().location]",
      "kind": "StorageV2",
      "sku": {
        "name": "[parameters('storageSKU')]",
        "tier": "Standard"
      }
    }
  ],
  "outputs": {}
}
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,933 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,320 questions
Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,303 questions
{count} votes

Accepted answer
  1. TP 83,731 Reputation points
    2023-11-29T18:27:24.4133333+00:00

    Hi Amardeep,

    Exercise - Add parameters and outputs to your Azure Resource Manager template

    -storageName and -storageSKU are not valid parameters for New-AzResourceGroupDeployment command, so you need to remove them from your command line.

    You can put your parameters in a separate json parameter file and refer to it using -TemplateParameterFile or you could create a hash table and use -TemplateParameterObject instead.

    For example, you could create a separate file named parameters.json with below contents to supply parameter values:

    {
        "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
        "contentVersion": "1.0.0.0",
        "parameters": {
            "storageName": {
                "value": "storageName12369"
            },
            "storageSKU": {
                "value": "Standard_LRS"
            }
        }
    }
    

    and the command would be similar to below:

    New-AzResourceGroupDeployment -Name $deploymentName -ResourceGroupName my-resource-group -TemplateFile $templateFile -TemplateParameterFile parameters.json
    
    

    New-AzResourceGroupDeployment

    https://learn.microsoft.com/en-us/powershell/module/az.resources/new-azresourcegroupdeployment?view=azps-11.0.0

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP

    0 comments No comments

0 additional answers

Sort by: Most helpful