@@ -151,12 +151,16 @@ $AzureGermanCloudPortalDomain = "https://portal.microsoftazure.de/"
151
151
$AzurePPEPortalDomain = " https://df.onecloud.azure-test.net/"
152
152
$AzureCanaryPortalDomain = " https://portal.azure.com/"
153
153
154
+ $DOMAINFQDNMACRO = " {DomainFqdn}"
155
+ $AzureLocalPortalDomain = " https://portal.$DOMAINFQDNMACRO "
156
+
154
157
$AzureCloud = " AzureCloud"
155
158
$AzureChinaCloud = " AzureChinaCloud"
156
159
$AzureUSGovernment = " AzureUSGovernment"
157
160
$AzureGermanCloud = " AzureGermanCloud"
158
161
$AzurePPE = " AzurePPE"
159
162
$AzureCanary = " AzureCanary"
163
+ $AzureLocal = " Azure.local"
160
164
161
165
$PortalCanarySuffix = ' ?feature.armendpointprefix={0}'
162
166
$PortalHCIResourceUrl = ' #@{0}/resource/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.AzureStackHCI/clusters/{3}/overview'
@@ -196,6 +200,11 @@ $AuthorityAzureGermanCloud = "https://login.microsoftonline.de"
196
200
$BillingServiceApiScopeAzureGermanCloud = " https://azurestackhci-usage.azurewebsites.de/.default"
197
201
$GraphServiceApiScopeAzureGermanCloud = " https://graph.cloudapi.de/.default"
198
202
203
+ $ServiceEndpointAzureLocal = " https://dp.aszrp.$DOMAINFQDNMACRO "
204
+ $AuthorityAzureLocal = " https://login.$DOMAINFQDNMACRO "
205
+ $BillingServiceApiScopeAzureLocal = " https://dp.aszrp.$DOMAINFQDNMACRO /.default"
206
+ $GraphServiceApiScopeAzureLocal = " https://graph.$DOMAINFQDNMACRO "
207
+
199
208
$RPAPIVersion = " 2022-12-01" ;
200
209
$HCIArcAPIVersion = " 2023-03-01"
201
210
$HCIArcExtensionAPIVersion = " 2021-09-01"
@@ -1029,6 +1038,10 @@ param(
1029
1038
$PortalCanarySuffixWithRegion = $PortalCanarySuffix -f $Region
1030
1039
return ($AzureCanaryPortalDomain + $PortalCanarySuffixWithRegion );
1031
1040
}
1041
+ elseif ($EnvironmentName -eq $AzureLocal )
1042
+ {
1043
+ return $AzureLocalPortalDomain ;
1044
+ }
1032
1045
}
1033
1046
1034
1047
function Get-DefaultRegion {
@@ -1063,6 +1076,10 @@ param(
1063
1076
{
1064
1077
$defaultRegion = " eastus2euap"
1065
1078
}
1079
+ elseif ($EnvironmentName -eq $AzureLocal )
1080
+ {
1081
+ $defaultRegion = " autonomous"
1082
+ }
1066
1083
1067
1084
return $defaultRegion
1068
1085
}
@@ -1130,6 +1147,13 @@ param(
1130
1147
$BillingServiceApiScope.Value = $BillingServiceApiScopeAzurePPE
1131
1148
$GraphServiceApiScope.Value = $GraphServiceApiScopeAzurePPE
1132
1149
}
1150
+ elseif ($EnvironmentName -eq $AzureLocal )
1151
+ {
1152
+ $ServiceEndpoint.Value = $ServiceEndpointAzureLocal
1153
+ $Authority.Value = $AuthorityAzureLocal
1154
+ $BillingServiceApiScope.Value = $BillingServiceApiScopeAzureLocal
1155
+ $GraphServiceApiScope.Value = $GraphServiceApiScopeAzureLocal
1156
+ }
1133
1157
}
1134
1158
1135
1159
@@ -1409,6 +1433,39 @@ param(
1409
1433
return $regionName
1410
1434
}
1411
1435
1436
+ function Initialize-AzureLocalConfig {
1437
+ $endpoints = Retry- Command - ScriptBlock { (Invoke-WebRequest - Uri " http://localhost:40342/metadata/endpoints?api-version=2020-06-01" - Headers @ {" metadata" = " true" ; " UseDefaultCredentials" = " true" } - UseBasicParsing).Content | ConvertFrom-Json }
1438
+
1439
+ # Extract domain FQDN from storage suffix.
1440
+ $domainFQDN = $endpoints.Suffixes.Storage
1441
+
1442
+ # Update default configurations based on the domain FQDN.
1443
+ $script :AzureLocalPortalDomain = $script :AzureLocalPortalDomain.Replace ($DOMAINFQDNMACRO , $domainFQDN )
1444
+ $script :ServiceEndpointAzureLocal = $script :ServiceEndpointAzureLocal.Replace ($DOMAINFQDNMACRO , $domainFQDN )
1445
+ $script :AuthorityAzureLocal = $script :AuthorityAzureLocal.Replace ($DOMAINFQDNMACRO , $domainFQDN )
1446
+ $script :BillingServiceApiScopeAzureLocal = $script :BillingServiceApiScopeAzureLocal.Replace ($DOMAINFQDNMACRO , $domainFQDN )
1447
+ $script :GraphServiceApiScopeAzureLocal = $script :GraphServiceApiScopeAzureLocal.Replace ($DOMAINFQDNMACRO , $domainFQDN )
1448
+
1449
+ Write-VerboseLog " Default Azure Local configurations - Portal: $AzureLocalPortalDomain , ServiceEndpoint: $ServiceEndpointAzureLocal , Authority: $AuthorityAzureLocal , BillingServiceApiScope: $BillingServiceApiScopeAzureLocal , GraphServiceApiScope: $GraphServiceApiScopeAzureLocal "
1450
+
1451
+ # Over write the default configurations if the endpoint is available as part of the metadata.
1452
+ if ($endpoints.portal ) {
1453
+ $script :AzureLocalPortal = $endpoints.portal
1454
+ }
1455
+ if ($endpoints.dataplaneEndpoints.hciDataplaneServiceEndpoint ) {
1456
+ $script :ServiceEndpointAzureLocal = $endpoints.dataplaneEndpoints.hciDataplaneServiceEndpoint
1457
+ $script :BillingServiceApiScopeAzureLocal = " $ ( $endpoints.dataplaneEndpoints.hciDataplaneServiceEndpoint ) /.default"
1458
+ }
1459
+ if ($endpoints.authentication.loginEndpoint ) {
1460
+ $script :AuthorityAzureLocal = $endpoints.authentication.loginEndpoint
1461
+ }
1462
+ if ($endpoints.graph ) {
1463
+ $script :GraphServiceApiScopeAzureLocal = $endpoints.graph
1464
+ }
1465
+
1466
+ Write-VerboseLog " Azure Local configurations after override - Portal: $AzureLocalPortalDomain , ServiceEndpoint: $ServiceEndpointAzureLocal , Authority: $AuthorityAzureLocal , BillingServiceApiScope: $BillingServiceApiScopeAzureLocal , GraphServiceApiScope: $GraphServiceApiScopeAzureLocal "
1467
+ }
1468
+
1412
1469
function Validate-RegionName {
1413
1470
[Microsoft.Azure.PowerShell.Cmdlets.StackHCI.DoNotExportAttribute ()]
1414
1471
param (
@@ -2895,6 +2952,12 @@ param(
2895
2952
Write-VerboseLog (" Cloud Management Infra supported: {0}" -f $isCloudManagementInfraSupported )
2896
2953
Write-VerboseLog (" Installing Mandatory extensions supported: {0}" -f $isDefaultExtensionSupported )
2897
2954
2955
+ if ($EnvironmentName -eq $AzureLocal )
2956
+ {
2957
+ Write-VerboseLog (" Registering in Azure Local. Initiliazing Azure.local configurations" )
2958
+ Initialize-AzureLocalConfig
2959
+ }
2960
+
2898
2961
if (-Not ([string ]::IsNullOrEmpty($RegContext.AzureResourceUri )))
2899
2962
{
2900
2963
if ([string ]::IsNullOrEmpty($ResourceName ))
@@ -4181,31 +4244,34 @@ param(
4181
4244
$TenantId = Azure- Login - SubscriptionId $SubscriptionId - TenantId $TenantId - ArmAccessToken $ArmAccessToken - GraphAccessToken $GraphAccessToken - AccountId $AccountId - EnvironmentName $EnvironmentName - ProgressActivityName $UnregisterProgressActivityName - UseDeviceAuthentication $UseDeviceAuthentication - Region $Region
4182
4245
4183
4246
Write-Progress - Id $MainProgressBarId - activity $UnregisterProgressActivityName - status $UnregisterArcMessage - percentcomplete 40
4184
-
4185
- $arcUnregisterRes = Unregister-ArcForServers - IsManagementNode $IsManagementNode - ComputerName $ComputerName - Credential $Credential - ResourceId $resourceId - Force:$Force - ClusterDNSSuffix $clusterDNSSuffix
4186
-
4187
- if ($arcUnregisterRes -eq $false )
4188
- {
4189
- $resultValue = [OperationStatus ]::Failed
4190
- $unregisterArcForServersWacErrorCode = 9117
4191
- $unregistrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyResult - Value $resultValue
4192
- Set-WacOutputProperty - IsWAC $IsWAC - PropertyName $OutputPropertyWacResult - PropertyValue $resultValue.ToString () - Output $unregistrationOutput
4193
- Set-WacOutputProperty - IsWAC $IsWAC - PropertyName $OutputPropertyWacErrorCode - PropertyValue $unregisterArcForServersWacErrorCode - Output $unregistrationOutput
4194
- Write-Output $unregistrationOutput | Format-List
4195
- Write-NodeEventLog - Message " ARC unregistration failed" - EventID 9117 - IsManagementNode $IsManagementNode - credentials $Credential - ComputerName $ComputerName - Level Warning
4196
- return
4197
- }
4198
- else
4247
+
4248
+ if ($EnvironmentName -ne $AzureLocal )
4199
4249
{
4200
- if ($DisableOnlyAzureArcServer -eq $true )
4250
+ $arcUnregisterRes = Unregister-ArcForServers - IsManagementNode $IsManagementNode - ComputerName $ComputerName - Credential $Credential - ResourceId $resourceId - Force:$Force - ClusterDNSSuffix $clusterDNSSuffix
4251
+
4252
+ if ($arcUnregisterRes -eq $false )
4201
4253
{
4202
- $resultValue = [OperationStatus ]::Success
4254
+ $resultValue = [OperationStatus ]::Failed
4255
+ $unregisterArcForServersWacErrorCode = 9117
4203
4256
$unregistrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyResult - Value $resultValue
4204
4257
Set-WacOutputProperty - IsWAC $IsWAC - PropertyName $OutputPropertyWacResult - PropertyValue $resultValue.ToString () - Output $unregistrationOutput
4258
+ Set-WacOutputProperty - IsWAC $IsWAC - PropertyName $OutputPropertyWacErrorCode - PropertyValue $unregisterArcForServersWacErrorCode - Output $unregistrationOutput
4205
4259
Write-Output $unregistrationOutput | Format-List
4206
- Write-NodeEventLog - Message " Disabling only ARC for Servers. UnRegistration completed successfully " - EventID 9008 - IsManagementNode $IsManagementNode - credentials $Credential - ComputerName $ComputerName
4260
+ Write-NodeEventLog - Message " ARC unregistration failed " - EventID 9117 - IsManagementNode $IsManagementNode - credentials $Credential - ComputerName $ComputerName - Level Warning
4207
4261
return
4208
4262
}
4263
+ else
4264
+ {
4265
+ if ($DisableOnlyAzureArcServer -eq $true )
4266
+ {
4267
+ $resultValue = [OperationStatus ]::Success
4268
+ $unregistrationOutput | Add-Member - MemberType NoteProperty - Name $OutputPropertyResult - Value $resultValue
4269
+ Set-WacOutputProperty - IsWAC $IsWAC - PropertyName $OutputPropertyWacResult - PropertyValue $resultValue.ToString () - Output $unregistrationOutput
4270
+ Write-Output $unregistrationOutput | Format-List
4271
+ Write-NodeEventLog - Message " Disabling only ARC for Servers. UnRegistration completed successfully" - EventID 9008 - IsManagementNode $IsManagementNode - credentials $Credential - ComputerName $ComputerName
4272
+ return
4273
+ }
4274
+ }
4209
4275
}
4210
4276
4211
4277
Write-Progress - Id $MainProgressBarId - activity $UnregisterProgressActivityName - status $UnregisterHCIUsageMessage - percentcomplete 45
0 commit comments