hari_azure
hari_azure

Reputation: 11

Azure Devops- Getting Error code: InvalidDeploymentParameterKey

I am trying to deploy basic infrastrture for mlops using arm template

but getting below error

There were errors in your deployment. Error code: InvalidDeploymentParameterKey.
##[error]One of the deployment parameters has an empty key.

i have a variable group - mlops_infra_variable_grp and none of keys is empty

Below is the arm template used for the deployment

template - iac-create-environment-pipeline-arm.yml

pr: none
trigger: none

variables:
- group: mlops_infra_variable_grp

stages:
- stage: 'Dev'
  displayName: 'Dev'
  jobs:
  - job: "Provision_Dev"
    displayName: "Provision Dev resources"
    pool:
      vmImage: 'ubuntu-latest'
    timeoutInMinutes: 0
    steps:
    - task: AzureResourceGroupDeployment@2
      inputs:
        azureSubscription: '$(AZURE_SERVICE_CON)'
        action: 'Create Or Update Resource Group'
        resourceGroupName: '$(RESOURCE_GROUP)'
        location: $(LOCATION)
        templateLocation: 'Linked artifact'
        csmFile: '$(Build.SourcesDirectory)/environment_setup/cloud-environment.json'
        overrideParameters: '-baseName $(BASE_NAME) -location $(LOCATION) -workspace $(WORKSPACE_NAME)'
        deploymentMode: 'Incremental'
      displayName: 'Deploy OH resources to Azure'

What causing the error?

Upvotes: 0

Views: 381

Answers (2)

Kevin Lu-MSFT
Kevin Lu-MSFT

Reputation: 35514

There were errors in your deployment. Error code: InvalidDeploymentParameterKey.

The cause of the issue could be that the value of the ARM Parameter contains special characters(e.g. space).

To solve this issue, you can add " "to the parameters value. For example: -baseName "$(BASE_NAME)"

Task sample:

variables:
- group: mlops_infra_variable_grp

stages:
- stage: 'Dev'
  displayName: 'Dev'
  jobs:
  - job: "Provision_Dev"
    displayName: "Provision Dev resources"
    pool:
      vmImage: 'ubuntu-latest'
    timeoutInMinutes: 0
    steps:
    - task: AzureResourceGroupDeployment@2
      inputs:
        azureSubscription: '$(AZURE_SERVICE_CON)'
        action: 'Create Or Update Resource Group'
        resourceGroupName: '$(RESOURCE_GROUP)'
        location: $(LOCATION)
        templateLocation: 'Linked artifact'
        csmFile: '$(Build.SourcesDirectory)/environment_setup/cloud-environment.json'
        overrideParameters: -baseName "$(BASE_NAME)" -location "$(LOCATION)" -workspace "$(WORKSPACE_NAME)"
        deploymentMode: 'Incremental'
      displayName: 'Deploy OH resources to Azure'

Upvotes: 0

Ziyang Liu-MSFT
Ziyang Liu-MSFT

Reputation: 5296

Try to deploy using Azure CLI command az deployment group create on your local machine and check if there is the same error. Replace { } with your actual value.

templateFile="{provide-the-path-to-the-template-file}"
az deployment group create \
  --resource-group {yourResourceGroup} \
  --template-file $templateFile \
  --parameters baseName={ } location={ } workspace={ }

If there is the same error, check if there is anything wrong in your template. If it works locally, the issue may be related to the pipeline settings. You can try to run the same commands in AzureCLI@2 - Azure CLI v2 task and check what's the result.

Upvotes: 0

Related Questions