Azure / Azure/PSRule.Rules.Azure
[BUG] [Experimental] Runtime values in tags and sku
- Dominant language
- PowerShell
- Stars
- 447
- Forks
- 109
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 23
Description
### Existing rule
_No response_
### Description of the issue
Originally reported https://github.com/microsoft/PSRule/issues/3425
When using the new experimental feature in Bicep from 0.46.1: https://github.com/Azure/bicep/releases
([Experimental] Runtime values in tags and sku)
```
resource example 'Microsoft...' = {
name: 'example'
location: resourceGroup().location
sku: {
name: this.existingResource().?sku.name ?? 'Standard'
}
tags: this.existingResource().?tags ?? {}
}
```
### Error messages
Exception calling "GetBicepParamResources" with "2" argument(s): "Unable to expand resources because the source file '/home/vsts/work/1/s/main.bicep' was not valid. The deployment 'root/2026-08-07_14.45' with symbolic name 'hubResourceGroup' failed. An error occurred evaluating expression '[if(parameters('keepExistingTags'), union(coalesce(tryGet(target('full'), 'tags'), createObject()), parameters('tags')), parameters('tags'))]' line 701 at path 'tags'. The function "target" was not found."
### Reproduction
Create a bicep file containing the new function:
```
resource example 'Microsoft...' = {
name: 'example'
location: resourceGroup().location
sku: {
name: this.existingResource().?sku.name ?? 'Standard'
}
tags: this.existingResource().?tags ?? {}
}
```
### Version of PSRule
2.9.0
### Version of PSRule for Azure
_No response_
### Additional context
Azure DevOps Microsoft Hosted Agent using the latest version of Linux, running in a PowerShell task using the latest version of bicep (0.46.1)
Contributor guide
Research direction
The payload names GetBicepParamResources and a reproducible Bicep example, but no repository file or test. Start by reproducing the example with Bicep 0.46.1 and trace the expansion failure around runtime values in tags and sku; done means the example expands without the missing "target" function error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100