Skip to content

Fix for incorrect error diagnostic on policyDefinitions existing resource usage#18169

Merged
harshpatel17 merged 4 commits into
mainfrom
harsh/hotfix
Oct 3, 2025
Merged

Fix for incorrect error diagnostic on policyDefinitions existing resource usage#18169
harshpatel17 merged 4 commits into
mainfrom
harsh/hotfix

Conversation

@harshpatel17
Copy link
Copy Markdown
Contributor

@harshpatel17 harshpatel17 commented Oct 3, 2025

Quick fixes for issues: 18163 & 18163

ValidParentScopes must contain scopes that can be written to and read from. The broken implementation only passed in scopes that could be written to, hence breaking customers who tried to use the existing keyword with a scope that could be written to and read from.

Root cause of the issue is that ResourceTypeComponents has a property named "ValidParentScopes", which is intended to capture both writable and readable scopes, but the type loading code was updated to be more precise about differentiating readable + writable scopes, and misinterpreted this field to just mean "writable scopes" (see here)

Microsoft Reviewers: Open in CodeFlow

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 3, 2025

Test this change out locally with the following install scripts (Action run 18227599251)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 18227599251
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 18227599251"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 18227599251
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 18227599251"

Comment thread src/Bicep.Core/TypeSystem/Providers/Az/AzResourceTypeFactory.cs
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 3, 2025

Dotnet Test Results

    96 files   -     48      96 suites   - 48   41m 40s ⏱️ - 28m 51s
12 408 tests  -     11  12 408 ✅  -     11  0 💤 ±0  0 ❌ ±0 
28 561 runs   - 14 268  28 561 ✅  - 14 268  0 💤 ±0  0 ❌ ±0 

Results for commit 9aa2b60. ± Comparison against base commit 066c054.

This pull request removes 1920 and adds 654 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӱ
�0\u0010\u0006��>E�\u0003�K�K���Ep�\u0001b{�b�4\u0015
��\u000e����V�|c� �\u000b��ol�"�Q�\u0004�\u0000s��\u0006
�T�yK*äy\u0001\u0006\u0006\u00152���'�ps�-�Q���\u0007�1��1�D\u001a\ D\u0018��X\u0019��YSK�jr���:$�"�Z�ܥh���o?������V�)�\u0010)&\u0011�1:��d�\u0011u��I2�����`[P}���lM���`��������<���<\u0001�ւ�\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӽ\u000e�0\u0010\u0007��>\u0005OP�ڻ\u0016\u0007vG_�Q\u0012?B1\u0002������\u0001�`b�c/�^���t�M��ŵ��\u0000R)�\u0006�!\u001a<�!�@�\u0002\u0002,\u0013\u0008�t�O2��\u001bw
��q�\u000fRY�cY�hy͠9\u0003i3 Rf\u0015j��\u001a&\u0017�\u001c�֟}u��TW�o(�\u001a�~h4������O�\u0007P\u0002\u0019��FiM!�H:���L�y�'��(���\u0004\u001aU+�\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
��A\u000b�0\u0014\u0007��\u0014�\u0007�����C�!#,\u0008��H!\u0003-�@�˧��tQ\u000b���`o\u001b�qk��U��(9�\u0000\u0016gC��+D�z\u000b�d(_��$A�\u0019���t���*�Q���\u0007ٞ��4K\u0002��\u00138�\u0011\u0007�\u0000\u0011gM��WC߸��\u001c�y���R^�=�k��1�\u001e��\u001b�>�\u001fl����ҵ\u001d�\u000c\�6��d����0��؄��z��̹���ߞI�4M\u001b�\u0013�;A\u0008\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003���
�0\u000c\u0000��}��\u0007���6N�݋��\u0007�.����&\u0014�w�;��
/�\u0007�wl\u0002IIS1]Y� �S݈D�l*���3J��w�B&�\u0001\u0018�ֆ1�F�ǥim�[�D�\u001f\u0014ϸm\u000f\u0005e\u0012u�!�O@$1\u0002�x�cۡ�Lye�}v(sr�؜�.�\u0018J��5�\u0001����ƫ��D1�� \u001a��00��\u0002��d'�|��<Z��*ڶ�/��P\u001d��Ξ\u001a�}�� \u0008��}�\u0010�\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003���
�0\u000c\u0007��\u0014>AMZ�����{��	��:�`�ػ�\u001e\u0006;(�8\u001d��cBHJ��xg�ma\u000fE�HM��R�
<�$��\u0001\u0012
�\u0017\u0010��+"�g�dD״���,��\u0007�4���,rd�\u0008�N2i40fj�{��\u001eFW�\u001e��]\us��Tn\u0018(�\u0006�~h0������S�\u0001�@\u0002�l�
��#)��E2����?־ \u0008� X�\u0013�"��\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003���\u000b�0\u0014\u0007��+�?`�����C�!#,\u0008���A\u0006Z���?�<D\u0017��?��9n\u000f�\u001b�w���z�d���z\u001c�\u000e%}\u0003M�~�z��H\u0018�\u0001\u0001�\\u0010bսO��QV�У���\u0007�sKVi�B�<���'@=�\t���;w������\u0012�y�jz-oyS�u�O}L�������-����q\u0010���\u0010\u0004\u0004\u0017��?J&�<�O;���m�:m\u000e��^X�\u0007�z&�0\u000ccx//�ܭ\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.DirectResourceCollectionTests ‑ DirectResourceCollectionAccess_NotAllowedWithinLoops ("output loopOutput array = [for i in range(0, 2): {
  prop: map(containerWorkers, (w) => w.properties.ipAddress.ip)
}]")
Bicep.Core.IntegrationTests.DirectResourceCollectionTests ‑ DirectResourceCollectionAccess_NotAllowedWithinLoops ("resource propertyLoop 'Microsoft.ContainerInstance/containerGroups@2022-09-01' = {
  name: 'gh9440-loop'
  location: 'westus'
  properties: {
    containers: [for i in range(0, 2): {
      name: 'gh9440-w1c-${i}'
      properties: {
        command: [
          'echo "${join(map(containerWorkers, (w) => w.properties.ipAddress.ip), ',')}"'
        ]
      }
    }]
  }
}")
Bicep.Core.IntegrationTests.DirectResourceCollectionTests ‑ DirectResourceCollectionAccess_NotAllowedWithinLoops ("var loopVar = [for i in range(0, 2): {
  prop: map(containerWorkers, (w) => w.properties.ipAddress.ip)
}]")
Bicep.Core.IntegrationTests.Emit.ParamsFileWriterTests ‑ Params_file_with_no_errors_should_compile_correctly ("
using 'main.bicep'

// involves all syntax
param myParam = {
  arr: [
    {
      a : 'b'
    }
    {
      c : true
    }
  ]
  name: 'complex object!'
  priority: 3
  val: null
  obj: {
      a: 'b'
      c: [
          'd'
           1
      ]
  }
}","
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "myParam": {
      "value": {
        "arr" : [
          {
            "a" : "b"
          },
          {
            "c" : true
          }
        ],
        "name" : "complex object!",
        "priority" : 3,
        "val" : null,
        "obj" : {
          "a" : "b",
          "c" : [
            "d",
            1
          ]
        }
      }
    }
  }
}","
param myParam object
")
…

♻️ This comment has been updated with latest results.

@harshpatel17 harshpatel17 enabled auto-merge (squash) October 3, 2025 15:39
@harshpatel17 harshpatel17 merged commit 61fbce4 into main Oct 3, 2025
42 checks passed
@harshpatel17 harshpatel17 deleted the harsh/hotfix branch October 3, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants