Skip to content

Conversation

harshpatel17
Copy link
Contributor

@harshpatel17 harshpatel17 commented Oct 13, 2025

Description

Since some extension resources do not have a concept of existing resources, it is a requirement to block the existing keyword when authoring these extension resources.

Example Usage

Write-Only Resource

Scenario: A resource type with no readable scopes but has writable scopes cannot be used with the existing keyword.

// This will produce error BCP441
resource writeOnlyResource 'Microsoft.Example/writeOnlyType@2024-01-01' existing = {
  name: 'myResource'
}

Error Message - Resource type "Microsoft.Example/writeOnlyType@2024-01-01" cannot be used with the 'existing' keyword.

Checklist

Microsoft Reviewers: Open in CodeFlow

@harshpatel17 harshpatel17 changed the title Draft Block the existing keyword for extension resources that have no readable scopes Oct 13, 2025
Copy link
Contributor

github-actions bot commented Oct 13, 2025

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

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

Copy link
Contributor

github-actions bot commented Oct 13, 2025

Dotnet Test Results

    96 files   -     48      96 suites   - 48   41m 18s ⏱️ - 28m 22s
12 412 tests  -     11  12 412 ✅  -     11  0 💤 ±0  0 ❌ ±0 
28 569 runs   - 14 272  28 569 ✅  - 14 272  0 💤 ±0  0 ❌ ±0 

Results for commit ebb07d3. ± Comparison against base commit 61a928a.

This pull request removes 1915 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
��K\u000e� \u0010\u0006`֞�\u0013���.�w�\u0015���H�iilb��ta�\u0002uS��|Kf\u0012��O��\u0019���l�\u0013�*U\u001047\u0008�\u0010��	\u0015\u001cQ�\u0000\u0008�T�\u0010\u001eg�$b���(K������\u001f\u001a[S��W����.9[���E����zp'�^\u001c9���ڛx{�#fo<��.�S�\u0001\u0018�\u00124g\u001a�\u0012!�����/��?����z�,˲,�;j7�%\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
��M\u000b� \u0018\u0007p�}��\u000f�ԩO\u000bv\u0008:��\u0015\u0004]C�Ђ��\u0016\u000c��Ct�貗 �x�\u0007|T�bo��V�.J,X =��F\u000c�y�|�r@\u0014�\u0008" ��v��;i�(+U�V���\u0007����4�!\u0005I����a\u0006\u0012\u0004�Y;w������\u0012�y�k|-oyS�u�O}L�������o�'�#*\u0008�\u000c�\u0019�H����(����?�(>.���9�bw�\u001fx�,˲��\u0000\u0010\u0010K�\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
���
\u0002!\u0014\u0006`�=��\u0000�w3�}��M\u000f`͉�f\u001aF\u0003!z��E�ih�
��G�'���\u0019�
:O\u0014�� ��h��|��c� fn(�F�ԍ��'y����(�8�\u0007�	vaWCɌ��2�8\u0011�*+�(��C5fq�¶�5\u0015D��Ǧo��ڿ}�l�����D��O�DLQ#��i!���)�\u001f�������\u0006b\u000b�\u0000�\u001c�\u0015t�)޸��˷g˲,���
�J��\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\u0014\u0006��>E�\u0003���
\u001d\u0004\u0007+R\u0005�U�
X�U�
\u0005_�t\u0010�\u0016�^\u0004�ɁsB�\u0007�{]��NLQ"&x�#�7lI�[�\u001b�+@�\u001b\u0006X	�\u0000�ux��.�(c��At\u000eu�f&$Jb\u0016PL\u0015��@̥�ٽs�\u001e	�]W�0�\u0013S�ky˛�|�c:\u001d>�7\�o�ǔ\u0003"�bT\u0011�\u0018�R\u0008�G8J&�<�O/���m�:m\u000e��[@�\u0003O=��8�3�\u0017% E�\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��K
�0\u0010\u0006�=EN��$��,�w�\u0015�\u0016|�T��\u0005��\u000b�E���
�[f2̄��d��]�yU\u000bE�M\u0004�\u001b\u0004:MG�\u0007H�м\u0000\u0003C�\u0019��워h��Ua�%f� ��9\u0017y�F��\u0012�\u0011�h�֛P;L֐�\s�Z��e�ť.��PL5���h���}kƧ�\u0003H�\u0004FI��T�?�p�/��?�����\u0006Q\u0014E�\u001a�b��H\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��K
�0\u0010\u0006�=E�\u0001Ҥy\u0019�{7�\u001b\u000f\u0010�\u0011+���BA���Bܴ��C0�.���\u0010~\u0012�m�\u0005�BU\u0013.�		\u001a\u001bu�\u0010��\u001d&4b��"���\u0008�v�Mz���Vn�9f��h�m��\u00103�(7\u0011�4�ʸ�X�Z2Tc\u0006��9�Y�BK.���������
���t3��r����G�I�\u0011UR2��Y2������P@[B�@���\u0008U��'{���n��y�t^�\u0003��\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
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.

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.

1 participant