Skip to content

[BUG] Bicep Feature: '[Experimental] Runtime values in tags and sku' breaks PSRule #3425

Description

@niekhodes

Description of the issue

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 ?? {}
}

I now always get the following error shown in the error messages.

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

How are you running PSRule

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)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions