-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
ARM - TemplatesbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.
Description
Description
Reported from: Azure/bicep#6644
Transferring TemplateParameterFile to absolute path will be wrong if this action is after opening a new thread.
Issue script & Debug output
#Deploy_VM_parameters.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"envname": {
"value": "testenv"
},
"location": {
"value": "East US"
}
}
}
```bicep
#Deploy_VM.bicep
param envname string
param location string
param now string = utcNow()
resource deploymentScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'testparamsasjob'
location: location
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '6.6'
arguments: ' -envname ${envname}'
scriptContent: '''
param (
[string]$envname
)
echo $envname
$DeploymentScriptOutputs = @{}
$DeploymentScriptOutputs['envName'] = $envname
'''
forceUpdateTag: now
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
timeout: 'PT3M'
}
}
output deploymentScriptOutput object = deploymentScript.properties.outputs.envName
This one fails:
New-AzResourceGroupDeployment `
-Name 'Deploy_Test_Vms' `
-TemplateFile '.\Deploy_VM.bicep' `
-TemplateParameterFile '.\Deploy_VM_parameters.json' `
-ResourceGroupName 'TestRG' -AsJob
: {14:28:38 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The value for the template parameter 'envname' at line '14' and column '20' is not provided. Please see https://aka.ms/resource-manager-parameter-files for usage details.'. , The deployment validation failed}
These two successes:
New-AzResourceGroupDeployment `
-Name 'Deploy_Test_Vms' `
-TemplateFile '.\Deploy_VM.bicep' `
-TemplateParameterFile '.\Deploy_VM_parameters.json' `
-ResourceGroupName 'TestRG'
New-AzResourceGroupDeployment -Name 'Deploy_Test_Vms'
-TemplateFile '.\Deploy_VM.bicep' -TemplateParameterFile 'C:\Bicep\Modules\Deploy_VM_parameters.json'
-ResourceGroupName 'TestRG' -AsJob
### Environment data
```PowerShell
N/A
Module versions
N/A
Error output
No response
Metadata
Metadata
Assignees
Labels
ARM - TemplatesbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.