diff --git a/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 b/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 index 5f2d66e8e937..b0e75aabf643 100644 --- a/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 +++ b/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 @@ -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 + } else { throw 'Invalid Azure Environment name' @@ -1018,6 +1024,10 @@ function Get-ManagementUrl { { $managementUrl = 'https://management.usgovcloudapi.net' } + elseif ($null -ne (Get-AzEnvironment -Name $EnvironmentName)) + { + $managementUrl = (Get-AzEnvironment -Name $EnvironmentName).ResourceManagerUrl + } else { throw "Invalid Azure Environment name" @@ -1208,6 +1218,10 @@ param( { return $AzureLocalPortalDomain; } + elseif ($null -ne (Get-AzEnvironment -Name $EnvironmentName)) + { + return (Get-AzEnvironment -Name $EnvironmentName).ManagementPortalUrl + } } function Get-DefaultRegion{ @@ -1320,6 +1334,13 @@ param( $BillingServiceApiScope.Value = $BillingServiceApiScopeAzureLocal $GraphServiceApiScope.Value = $GraphServiceApiScopeAzureLocal } + elseif ($null -ne (Get-AzEnvironment -Name $EnvironmentName)) + { + $ServiceEndpoint.Value = "https://doesnotmatter/" + $Authority.Value = (Get-AzEnvironment -Name $EnvironmentName).ActiveDirectoryAuthority + $BillingServiceApiScope.Value = $DefaultBillingServiceApiScope + $GraphServiceApiScope.Value = (Get-AzEnvironment -Name $EnvironmentName).GraphEndpointResourceId + "/.default" + } } diff --git a/src/StackHCI/StackHCI/ChangeLog.md b/src/StackHCI/StackHCI/ChangeLog.md index b30f03b7e01a..9f687b489301 100644 --- a/src/StackHCI/StackHCI/ChangeLog.md +++ b/src/StackHCI/StackHCI/ChangeLog.md @@ -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.