Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
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
AzureAppConfigurationEndpointSuffixandAzureAppConfigurationEndpointResourceIdtoPSAzureEnvironment(including PSObject deserialization and equality comparison). - Added corresponding parameters to
Add-AzEnvironmentandSet-AzEnvironment, and wired them into the endpoint-setting path for the name-based parameter set. - Included the new fields in
PSAzureEnvironment.Equalscomparisons.
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). |
| && AzureAttestationServiceEndpointResourceId == other.AzureAttestationServiceEndpointResourceId | ||
| && AzureAttestationServiceEndpointSuffix == other.AzureAttestationServiceEndpointSuffix | ||
| && AzureAppConfigurationEndpointResourceId == other.AzureAppConfigurationEndpointResourceId | ||
| && AzureAppConfigurationEndpointSuffix == other.AzureAppConfigurationEndpointSuffix | ||
| && ContainerRegistryEndpointSuffix == other.ContainerRegistryEndpointSuffix; |
There was a problem hiding this comment.
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).
| [Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Dns suffix of Azure App Configuration.")] |
There was a problem hiding this comment.
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.
| [Parameter(ParameterSetName = MetadataParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true, | |
| HelpMessage = "Dns suffix of Azure App Configuration.")] |
| [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.")] |
There was a problem hiding this comment.
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.
| [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.")] |
| SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointSuffix, | ||
| nameof(AzureAppConfigurationEndpointSuffix)); | ||
| SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointResourceId, | ||
| nameof(AzureAppConfigurationEndpointResourceId)); |
There was a problem hiding this comment.
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.
| [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.")] |
There was a problem hiding this comment.
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.
| [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.")] |
| HelpMessage = "Dns suffix of Azure App Configuration.")] | ||
| public string AzureAppConfigurationEndpointSuffix { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, |
There was a problem hiding this comment.
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.
| [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, | |
| [Parameter(ParameterSetName = EnvironmentPropertiesParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true, |
| SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointSuffix, | ||
| nameof(AzureAppConfigurationEndpointSuffix)); | ||
| SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointResourceId, | ||
| nameof(AzureAppConfigurationEndpointResourceId)); |
There was a problem hiding this comment.
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.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
isra-fel
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Equalsto includeAzureAppConfigurationEndpoint*. IfPSAzureEnvironmentoverridesGetHashCode, 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.")] |
There was a problem hiding this comment.
Use the standard capitalization "DNS" in help text (currently "Dns").
| HelpMessage = "Dns suffix of Azure App Configuration.")] | |
| HelpMessage = "DNS suffix of Azure App Configuration.")] |
| public string AzureAttestationServiceEndpointResourceId { get; set; } | ||
|
|
||
| [Parameter(ParameterSetName = EnvironmentPropertiesParameterSet, Mandatory = false, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Dns suffix of Azure App Configuration.")] |
There was a problem hiding this comment.
Use the standard capitalization "DNS" in help text (currently "Dns").
| SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointSuffix, | ||
| nameof(AzureAppConfigurationEndpointSuffix)); | ||
| SetEndpointIfBound(newEnvironment, AzureEnvironment.ExtendedEndpoint.AzureAppConfigurationEndpointResourceId, | ||
| nameof(AzureAppConfigurationEndpointResourceId)); |
There was a problem hiding this comment.
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.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
isra-fel
left a comment
There was a problem hiding this comment.
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; } |
There was a problem hiding this comment.
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.
Description
Make it so you can set the App Config environment. Required for new clouds.
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.