Search code examples
azurecertificate

Azure ARM template script error when creating certificate for apex domain


Really scratching my head on this one, I keep getting the error below:

New-AzureRmResourceGroupDeployment : A parameter cannot be found that matches parameter name 'SubjectName'. At azure_cli_-_create_cert.ps1:12 char:80

for the Azure ARM template script below:

     $subscription = ""
       $resourceGroupName = ""
       $appServicePlanName = ""
       $subjectName = ""
                
       Set-AzureRmContext -SubscriptionId $subscription
                
       $appServicePlan = Get-AzureRmResource `
                 | Where-Object {$_.ResourceGroupName -eq $resourceGroupName} `
                 | Where-Object {$_.Name -eq $appServicePlanName}
         
       New-AzureRMResourceGroupDeployment -ResourceGroupName $resourceGroupName -SubjectName $subjectName -AppServicePlanName $appServicePlanName -Location $appServicePlan.Location -TemplateFile "CreateHttpFreeCert.json" 

Does anyone know why this is?

I am running the script in a windows powershell script (i.e. .ps1 script).


Solution

  • It seems like you need to supply the parameters for your template in as a JSON file using -TemplateParameterFile or -TemplateParameterObject

    https://learn.microsoft.com/en-us/powershell/module/azurerm.resources/new-azurermresourcegroupdeployment?view=azurermps-6.13.0#example-1--use-a-custom-template-and-parameter-file-to-create-a-deployment