-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Added support for custom Azure Environments #29067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -210,6 +210,8 @@ $AuthorityAzureLocal = "https://login.$DOMAINFQDNMACRO" | |||||||||||||||||||||||||||||||||||||||||
| $BillingServiceApiScopeAzureLocal = "https://dp.aszrp.$DOMAINFQDNMACRO/.default" | ||||||||||||||||||||||||||||||||||||||||||
| $GraphServiceApiScopeAzureLocal = "https://graph.$DOMAINFQDNMACRO" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| $DefaultBillingServiceApiScope = "1322e676-dee7-41ee-a874-ac923822781c/.default" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| $RPAPIVersion = "2025-09-15-preview"; | ||||||||||||||||||||||||||||||||||||||||||
| $HCIArcAPIVersion = "2025-09-15-preview" | ||||||||||||||||||||||||||||||||||||||||||
| $HCIArcExtensionAPIVersion = "2025-09-15-preview" | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -719,6 +721,10 @@ $registerArcScript = { | |||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| $managementUrl = 'https://management.usgovcloudapi.net' | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| elseif ($null -ne (Get-AzEnvironment -Name $EnvironmentName)) | ||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||
| $managementUrl = (Get-AzEnvironment -Name $EnvironmentName).ResourceManagerUrl | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+724
to
+726
|
||||||||||||||||||||||||||||||||||||||||||
| elseif ($null -ne (Get-AzEnvironment -Name $EnvironmentName)) | |
| { | |
| $managementUrl = (Get-AzEnvironment -Name $EnvironmentName).ResourceManagerUrl | |
| elseif ($null -ne ($environment = Get-AzEnvironment -Name $EnvironmentName) -and $null -ne $environment.ResourceManagerUrl) | |
| { | |
| $managementUrl = $environment.ResourceManagerUrl |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential null reference error if ResourceManagerUrl property is null. Same issue as in the registerArcScript - the environment object's properties may be null even when the environment exists. Add proper null validation before accessing the property.
| elseif ($null -ne (Get-AzEnvironment -Name $EnvironmentName)) | |
| { | |
| $managementUrl = (Get-AzEnvironment -Name $EnvironmentName).ResourceManagerUrl | |
| } | |
| else | |
| { | |
| throw "Invalid Azure Environment name" | |
| else | |
| { | |
| $environment = Get-AzEnvironment -Name $EnvironmentName | |
| if ($null -ne $environment -and $null -ne $environment.ResourceManagerUrl) | |
| { | |
| $managementUrl = $environment.ResourceManagerUrl | |
| } | |
| else | |
| { | |
| throw "Invalid Azure Environment name" | |
| } |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential null reference error if ManagementPortalUrl property is null. Custom Azure Environments may not have this property configured. Consider adding validation and a meaningful error message or default value.
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded value 'https://doesnotmatter/' is unclear and potentially confusing. Add a comment explaining why this placeholder URL is used and whether it's actually utilized in the custom environment scenario.
| { | |
| { | |
| # Use a dummy URL for custom Az environments. The Stack HCI service endpoint is not | |
| # resolved from this value in this code path; only the authority and scopes taken | |
| # from Get-AzEnvironment are used for authentication, so the exact URL does not matter. |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential null reference errors if ActiveDirectoryAuthority or GraphEndpointResourceId properties are null. Custom environments may not have these properties configured. Add null checks and provide meaningful error messages if critical properties are missing.
| $ServiceEndpoint.Value = "https://doesnotmatter/" | |
| $Authority.Value = (Get-AzEnvironment -Name $EnvironmentName).ActiveDirectoryAuthority | |
| $BillingServiceApiScope.Value = $DefaultBillingServiceApiScope | |
| $GraphServiceApiScope.Value = (Get-AzEnvironment -Name $EnvironmentName).GraphEndpointResourceId + "/.default" | |
| $environment = Get-AzEnvironment -Name $EnvironmentName | |
| if (-not $environment.ActiveDirectoryAuthority) | |
| { | |
| throw "The ActiveDirectoryAuthority endpoint is not configured for Azure environment '$EnvironmentName'. Configure this property for the environment and try again." | |
| } | |
| if (-not $environment.GraphEndpointResourceId) | |
| { | |
| throw "The GraphEndpointResourceId endpoint is not configured for Azure environment '$EnvironmentName'. Configure this property for the environment and try again." | |
| } | |
| $ServiceEndpoint.Value = "https://doesnotmatter/" | |
| $Authority.Value = $environment.ActiveDirectoryAuthority | |
| $BillingServiceApiScope.Value = $DefaultBillingServiceApiScope | |
| $GraphServiceApiScope.Value = $environment.GraphEndpointResourceId + "/.default" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| --> | ||
| ## Upcoming Release | ||
| * Improved cloud deployment detection during Azure Arc repair operations to prevent duplicate enablement attempts and ensure smoother deployment experiences. | ||
| * Added ability to register in custom Azure Environments | ||
|
||
|
|
||
| ## Version 2.6.5 | ||
| * ARC Enablement of Nodes Before Triggering Registration in New Registration Flow. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GUID
1322e676-dee7-41ee-a874-ac923822781cis the Azure Stack HCI Usage Service first-party app ID (defined on line 148 as$UsageServiceFirstPartyAppId). Consider using the existing variable for consistency:$DefaultBillingServiceApiScope = \"$UsageServiceFirstPartyAppId/.default\"or add a comment explaining this is intentionally duplicated.