In my azure-pipelines.yml file I am unable to deploy via a bicep file and set values for its parameters.
Here is the start of my bicep file
targetScope = 'subscription'
param location string = 'uksouth'
param environmentCode string
Here is the task in my azure-pipelines.yml file
- task: AzureResourceManagerTemplateDeployment@3
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'MyName(SomeGuid)'
subscriptionId: 'SomeGuid'
action: 'Create Or Update Resource Group'
resourceGroupName: '$(resourceGroupName)'
location: '$(location)'
templateLocation: 'Linked artifact'
csmFile: '$(Build.SourcesDirectory)/Infrastructure/Main.bicep'
deploymentMode: 'Incremental'
addSpnToEnvironment: true
useWithoutJSON: true
I have tried overriding parameters in 3 different ways, but get an error for each
- No dashes on names
overrideParameters: 'location $(location) environmentCode $(environmentCode)'
##[error]One of the deployment parameters has an empty key. Please see https://aka.ms/arm-create-parameter-file for details.
- Single dash on names
overrideParameters: '-location $(location) -environmentCode $(environmentCode)'
There were errors in your deployment. Error code: InvalidTemplate.
##[error]Deployment template validation failed: 'The template resource 'resourceGroup' at line '1' and column '1182' is not valid: The language expression property 'location' doesn't exist, available properties are 'name, properties'.. Please see https://aka.ms/arm-functions for usage details.'.
- Two dashes on names
overrideParameters: '--location $(location) --environmentCode $(environmentCode)'
There were errors in your deployment. Error code: InvalidTemplate.
##[error]Deployment template validation failed: 'The template parameters '-location, -environmentCode' in the parameters file are not valid; they are not present in the original template and can therefore not be provided at deployment time. The only supported parameters for this template are 'location, environmentCode'. Please see https://aka.ms/arm-pass-parameter-values for usage details.'.
I don't know what kind of actual resources you want to deploy,
deploymentScopeinputs ofAzureResourceManagerTemplateDeployment@3be profoundly affected by thetargetScopeinbicep file.I have coded a sample to show two types of deployment, one in
resource group level, the other issubscription levelrg.bicepvnet.bicepazure-pipelines.ymlmy result: