Skip to content

Add App Config to Azure Environment#29393

Open
mrm9084 wants to merge 3 commits intoAzure:mainfrom
mrm9084:AddAppConfigToAzureEnvironment
Open

Add App Config to Azure Environment#29393
mrm9084 wants to merge 3 commits intoAzure:mainfrom
mrm9084:AddAppConfigToAzureEnvironment

Conversation

@mrm9084
Copy link
Copy Markdown
Member

@mrm9084 mrm9084 commented Apr 10, 2026

Description

Make it so you can set the App Config environment. Required for new clouds.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings April 10, 2026 18:05
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Copy Markdown
Contributor

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 extends Azure PowerShell’s environment model (Accounts module) to allow configuring Azure App Configuration endpoints (suffix + resource ID) on AzEnvironment, supporting additional/new cloud environments.

Changes:

  • Added AzureAppConfigurationEndpointSuffix and AzureAppConfigurationEndpointResourceId to PSAzureEnvironment (including PSObject deserialization and equality comparison).
  • Added corresponding parameters to Add-AzEnvironment and Set-AzEnvironment, and wired them into the endpoint-setting path for the name-based parameter set.
  • Included the new fields in PSAzureEnvironment.Equals comparisons.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/Accounts/Authentication.ResourceManager/Models/PSAzureEnvironment.cs Adds App Config endpoint properties and includes them in PSObject deserialization + equality logic.
src/Accounts/Accounts/Environment/SetAzureRMEnvironment.cs Adds Set-AzEnvironment parameters for App Config endpoints and sets them when bound (name-based path).
src/Accounts/Accounts/Environment/AddAzureRMEnvironment.cs Adds Add-AzEnvironment parameters for App Config endpoints and sets them when bound (name-based path).

Comment on lines 448 to 452
&& AzureAttestationServiceEndpointResourceId == other.AzureAttestationServiceEndpointResourceId
&& AzureAttestationServiceEndpointSuffix == other.AzureAttestationServiceEndpointSuffix
&& AzureAppConfigurationEndpointResourceId == other.AzureAppConfigurationEndpointResourceId
&& AzureAppConfigurationEndpointSuffix == other.AzureAppConfigurationEndpointSuffix
&& ContainerRegistryEndpointSuffix == other.ContainerRegistryEndpointSuffix;
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Equals now includes the App Configuration fields, but GetHashCode() still uses base.GetHashCode() (identity-based). This violates the Equals/GetHashCode contract and can break hash-based collections. Update GetHashCode() to hash the same fields used by Equals (or adjust/remove the Equals override).

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +197
[Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

This App Configuration parameter is declared for the ARMEndpoint (metadata) parameter set, but the ARMEndpoint branch of ExecuteCmdlet() never applies it to newEnvironment. Passing it alongside -ARMEndpoint will be silently ignored. Either apply it in the metadata branch (e.g., via SetEndpointIfProvided) or remove it from the metadata parameter set.

Suggested change
[Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]

Copilot uses AI. Check for mistakes.
Comment on lines +202 to +203
[Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource identifier of the Azure App Configuration service that is the recipient of the requested token.")]
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Same issue as the suffix parameter: this resourceId parameter is available in the ARMEndpoint parameter set, but the metadata branch of ExecuteCmdlet() doesn’t persist it into the environment, so it has no effect when used with -ARMEndpoint.

Suggested change
[Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource identifier of the Azure App Configuration service that is the recipient of the requested token.")]

Copilot uses AI. Check for mistakes.
Comment on lines +402 to +405
SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointSuffix,
nameof(AzureAppConfigurationEndpointSuffix));
SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointResourceId,
nameof(AzureAppConfigurationEndpointResourceId));
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Test coverage: EnvironmentCmdletTests.CanCreateEnvironmentWithAllProperties covers many endpoint parameters but not the new App Configuration suffix/resourceId. Please extend that test to assert these endpoints are persisted when bound, to prevent regressions.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +177 to +182
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
public string AzureAppConfigurationEndpointSuffix { get; set; }

[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource identifier of the Azure App Configuration service that is the recipient of the requested token.")]
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

This new parameter can be bound while using the ARMEndpoint parameter set (it isn’t restricted to Name), but the ARMEndpoint branch of ExecuteCmdlet() doesn’t apply it to the environment being created/updated. Either apply it in the metadata branch or restrict it to the Name parameter set to avoid misleading behavior.

Suggested change
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
public string AzureAppConfigurationEndpointSuffix { get; set; }
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource identifier of the Azure App Configuration service that is the recipient of the requested token.")]
[Parameter(ParameterSetName = EnvironmentPropertiesParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
[Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
public string AzureAppConfigurationEndpointSuffix { get; set; }
[Parameter(ParameterSetName = EnvironmentPropertiesParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource identifier of the Azure App Configuration service that is the recipient of the requested token.")]
[Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource identifier of the Azure App Configuration service that is the recipient of the requested token.")]

Copilot uses AI. Check for mistakes.
HelpMessage = "Dns suffix of Azure App Configuration.")]
public string AzureAppConfigurationEndpointSuffix { get; set; }

[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Same issue as the suffix parameter: -AzureAppConfigurationEndpointResourceId can be specified with -ARMEndpoint, but the metadata branch doesn’t persist it, so it will be ignored.

Suggested change
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
[Parameter(ParameterSetName = EnvironmentPropertiesParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,

Copilot uses AI. Check for mistakes.
Comment on lines +369 to +372
SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointSuffix,
nameof(AzureAppConfigurationEndpointSuffix));
SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointResourceId,
nameof(AzureAppConfigurationEndpointResourceId));
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

Test coverage: there are existing cmdlet tests asserting endpoint parameters are saved for Add/Set-AzEnvironment, but none cover the new App Configuration suffix/resourceId. Add/extend a test to verify these two endpoints are persisted when provided.

Copilot generated this review using guidance from repository custom instructions.
@VeryEarly
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@VeryEarly
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@VeryEarly VeryEarly self-assigned this Apr 13, 2026
Copy link
Copy Markdown
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

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

Please remove the parameter from MetadataParameterSet because the parameter set handles only a few endpoints returned by the metadata API.

Besides, please update the change log. Thank you.

Copilot AI review requested due to automatic review settings April 13, 2026 20:14
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/Accounts/Authentication.ResourceManager/Models/PSAzureEnvironment.cs:1

  • This change updates Equals to include AzureAppConfigurationEndpoint*. If PSAzureEnvironment overrides GetHashCode, it must be updated to include the same fields; otherwise objects that compare equal can produce different hash codes, breaking hash-based collections (e.g., Dictionary, HashSet).
// ----------------------------------------------------------------------------------

public string AzureAttestationServiceEndpointResourceId { get; set; }

[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Use the standard capitalization "DNS" in help text (currently "Dns").

Suggested change
HelpMessage = "Dns suffix of Azure App Configuration.")]
HelpMessage = "DNS suffix of Azure App Configuration.")]

Copilot uses AI. Check for mistakes.
public string AzureAttestationServiceEndpointResourceId { get; set; }

[Parameter(ParameterSetName = EnvironmentPropertiesParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Use the standard capitalization "DNS" in help text (currently "Dns").

Copilot uses AI. Check for mistakes.
Comment on lines +369 to +372
SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointSuffix,
nameof(AzureAppConfigurationEndpointSuffix));
SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointResourceId,
nameof(AzureAppConfigurationEndpointResourceId));
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The cmdlet now supports setting App Configuration endpoints. Add/extend a test to assert that Set-AzEnvironment persists AzureAppConfigurationEndpointSuffix and AzureAppConfigurationEndpointResourceId onto the environment object (similar to existing endpoint-property assertions), so regressions in parameter binding or endpoint key wiring are caught.

Copilot uses AI. Check for mistakes.
@VeryEarly
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@VeryEarly VeryEarly assigned isra-fel and unassigned VeryEarly Apr 14, 2026
@mrm9084 mrm9084 requested a review from isra-fel April 14, 2026 18:34
Copy link
Copy Markdown
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

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

Code change looks good. One last thing - could you refresh the help documents by following the steps in https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/help-generation.md

The reference docs for the Add and Set cmdlets are expected to be updated.
Thanks!

@mrm9084
Copy link
Copy Markdown
Member Author

mrm9084 commented Apr 15, 2026

Code change looks good. One last thing - could you refresh the help documents by following the steps in https://github.com/Azure/azure-powershell/blob/main/documentation/development-docs/help-generation.md

The reference docs for the Add and Set cmdlets are expected to be updated. Thanks!

@isra-fel I'm unsure what I'm doing wrong when I generate I only get ProgressAction changes, nothing to do with what I did.


[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Dns suffix of Azure App Configuration.")]
public string AzureAppConfigurationEndpointSuffix { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We shouldn't be including endpoint suffix. It's subject to change, and clients should query endpoint off an app configuration resource rather than build endpoints.

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.

5 participants