Skip to content

Conversation

@jeskew
Copy link
Member

@jeskew jeskew commented Nov 14, 2025

Resolves #17555

Microsoft Reviewers: Open in CodeFlow

@jeskew jeskew added do not merge Do not merge this pull request yet. 📘 Docs Needed labels Nov 14, 2025
@github-actions
Copy link
Contributor

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

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

@github-actions
Copy link
Contributor

Dotnet Test Results

   102 files   -     51     102 suites   - 51   39m 52s ⏱️ - 43m 7s
12 545 tests  -     12  12 545 ✅  -     12  0 💤 ±0  0 ❌ ±0 
28 835 runs   - 14 408  28 835 ✅  - 14 408  0 💤 ±0  0 ❌ ±0 

Results for commit 364708f. ± Comparison against base commit 2f3624a.

This pull request removes 1954 and adds 662 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Cli.UnitTests.Services.ReplEnvironmentTests ‑ ShouldSubmitBuffer_terminates_at_expected_point ("var foo = {
")
Bicep.Cli.UnitTests.Services.ReplEnvironmentTests ‑ ShouldSubmitBuffer_terminates_at_expected_point ("var multilineString = '''
Line 1
Line 2
Line 3
'''")
Bicep.Cli.UnitTests.Services.ReplEnvironmentTests ‑ ShouldSubmitBuffer_terminates_at_expected_point ("var outRoleAssignments object[] = union(map(
  filter(varMockedEntraGroupIds, item => !contains(item.uniqueName, 'DevOps')),
  group => {
    principalId: group.groupId
    definition: group.roleToAssign
    relativeScope: ''
    principalType: 'Group'
  }
),[
  {
    principalId: '22222222-2222-2222-2222-222222222222'
    definition: 'Reader'
    relativeScope: ''
    principalType: 'ServicePrincipal'
  }
])")
Bicep.Cli.UnitTests.Services.ReplEnvironmentTests ‑ ShouldSubmitBuffer_terminates_at_expected_point ("var test = {
  abc: 'def' // boo
}")
Bicep.Cli.UnitTests.Services.ReplEnvironmentTests ‑ ShouldSubmitBuffer_terminates_at_expected_point ("var varMockedEntraGroupIds = [
  {
    uniqueName: 'Reader-Group'
    roleToAssign: 'Reader'
    groupId: '11111111-1111-1111-1111-111111111111'
  }
  {
    uniqueName: 'Contributor-Group'
    roleToAssign: 'Contributor'
    groupId: '22222222-2222-2222-2222-222222222222'
  }
  {
    uniqueName: 'DevOps-Group'
    groupId: '33333333-3333-3333-3333-333333333333'
  }
]")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӽ
�0\u0010\u0007��>E�\u0001һ�\u0015�]\u0004\u0017\u001f �\u0013\u0015[K[� ��� \u000eZ\l+�ߘ;���_\u0004+W/�%T���&\u0010��a�z{�Be\u0019�\u0007``5H�x��Q^]��\u0015�(C�������\u001c���b\u0008Q�H���IS�v�0湫��C�P-��9k�Ӯ����ux�_�+������F�\u0016B)5\u0003��n>H&�<�W>]gT紭(YR��b:�;w*�6�l��y^���0J�\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
�Ի
�0\u0014\u0006��>E�\u0003�'w#t\u0010\u001c�H\u0015\u0004W	�`�Vi+\u0014|y�A\u001c���"�o�9���?�ۚj\u0019�(�\u000b,��0�\u001c�$�\u001f�\u001b�+D�\u0013 P\u0002\u0018BN��(�nEi�z�!��At�2Ic�(�\u0008�@	\u0016\3:\u0015��vl�\u0011�\My�,�+|..YӞ���}L�������o�\u0007�\u0011\u0011\u0004�\u0002ʘ@ \u0005o�?H&�<�w7\u0008��u�8�v�Н9�\u000f<�L�eYV�\u001e�Y8�\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
��K
�0\u0010\u0006�=EO�ΤI�.�w�\u0015�\u0006|�T�\u0014\u000b��M\u0017���Mm\u0004�-3\u0003�L�y�1�ښ�m;�K�s6;\u0008��o�G(5Cz\u0000\u0006�@0�
���i�(K���\u0004e�\u001fj[!�\u0002e	\u0002�\u0002)	W���*av6~_��䚋�Ǯqc�=�\u001f��ɔ�\u001f�֖>�\u001fB�Q!(\u0002Q\u0014*�\u001f\u0005��/��?���\u0016{�$I�$�;\u0018]ۘ\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�L�T�ލ��\u0003D;�b��\u0015
��M\u0017���>�|���L\u0018~1^�vF>��\u0016\u0012`2\u0016lh\u0010\u0018���wPY��\u000e\u0018X�S�x;�&O���Wa�O��A���\u0015��5\u0012�sV\u000b%�V֍Bm�W�	?�f��ʜZ���e�^�����Q����7�U�A*�\u001aA[H\u0011%\u0003��	��H&�<�\u0017�,KjO�n(�S��*��?�t��nQ\u0014E���\u0000��$�\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��K\u000e�0\u0010\u0006�=\u0005'(3}к`��+4J�#\u0014C!�\u0018��0q\u0001q�`b�e��L��������\u001d�:p	�M9�\u001b�L���\u0001jdh^���J3���O2�
��i�%z� a\u0013ל�"G�IT�\u001aM�@Xm��\u000e�{��\s�[��U��%T~((�
�>h4������S�\u0001\u0004�?\u0000�\u0001�()�(��H&�<����\u0013DQ\u0014Ekx\u0002�}��\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
…

@jeskew jeskew removed the do not merge Do not merge this pull request yet. label Nov 17, 2025
@jeskew jeskew requested review from a team and Copilot November 17, 2025 16:50
Copilot finished reviewing on behalf of jeskew November 17, 2025 16:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the deployment() function's return type signature to conditionally include a metadata property in the template object when metadata declarations are present in the Bicep file. This allows users to access metadata values (like name, description, version) at deployment time through deployment().properties.template.metadata.<propertyName>.

  • Replaced static GetDeploymentReturnType with dynamic GetDeploymentReturnResult to enable runtime inspection of metadata declarations
  • Consolidated separate deployment function overloads for different scopes into a single unified overload
  • Added conditional metadata property to template return type based on presence of metadata declarations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Bicep.Core/Semantics/Namespaces/AzNamespaceType.cs Refactored deployment() function to dynamically build return type with conditional metadata property based on semantic model, and consolidated scope-specific overloads into single unified implementation
src/Bicep.Core.IntegrationTests/ScenarioTests.cs Added integration test verifying metadata properties can be accessed through deployment().properties.template.metadata

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Return all properties with deployment() function in case of languageVersion 2.0

2 participants