AzurePowerShell outputs property value is blank
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 81
Description
**Bicep version**
Bicep CLI version 0.20.4 (c9422e016d)
**Describe the bug**
Value of `outputs` from a resource that uses `AzurePowerShell` does not seem to provide a value when referenced by another resource.
**To Reproduce**
Steps to reproduce the behavior:
1. Using an existing resource group, run the following command, using the contents specified in **Additional context**.
`New-AzResourceGroupDeployment -ResourceGroupName -TemplateFile .\test-prop-outputs.bicep`
1. Observe the error indicates that ` DNS prefix must contain between 1 and 54 characters`.
NOTE: This was working fine in our scripts until the last few days.
**Additional context**
test-prop-outputs.bicep
``` BICEP
param clusterName string = 'test-aks'
param rgName string = resourceGroup().name
param subId string = subscription().subscriptionId
param loc string = resourceGroup().location
resource clusterProperties 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'clusterProperties'
location: loc
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '8.3'
retentionInterval: 'P1D'
arguments: '-ClusterName ${clusterName} -ClusterResourceGroup ${rgName} -ClusterSubscriptionId ${subId}'
scriptContent: '''
param(
[string]$ClusterName,
[string]$ClusterResourceGroup,
[string]$ClusterSubscriptionId
)
# Add default values to output
$DeploymentScriptOutputs = @{
dnsPrefix = $ClusterName
}
'''
}
}
resource aksCluster 'Microsoft.ContainerService/managedClusters@2022-07-01' = {
name: clusterName
location: loc
sku: {
name: 'Basic'
tier: 'Free'
}
identity: {
type: 'SystemAssigned'
}
properties: {
enableRBAC: true
dnsPrefix: clusterProperties.properties.outputs.dnsPrefix
agentPoolProfiles: [
{
name: 'mynodepool'
count: 1
vmSize: 'Standard_DS4_v2'
osType: 'Linux'
mode: 'System'
}
]
}
}
output clusterResourceId string = aksCluster.id
// Comment out resource aksCluster and the above output to see this next output work.
output dnsPrefix string = clusterProperties.properties.outputs.dnsPrefix
```
Contributor guide
Assessment
This issue has not been assessed yet.