Skip to content

Commit ee18261

Browse files
Migrate StackHCI from generation to main (#26263)
* Move StackHCI to main * Update ChangeLog.md --------- Co-authored-by: azure-powershell-bot <[email protected]>
1 parent 547f20e commit ee18261

File tree

53 files changed

+941
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+941
-124
lines changed

src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1

Lines changed: 84 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,16 @@ $AzureGermanCloudPortalDomain = "https://portal.microsoftazure.de/"
151151
$AzurePPEPortalDomain = "https://df.onecloud.azure-test.net/"
152152
$AzureCanaryPortalDomain = "https://portal.azure.com/"
153153

154+
$DOMAINFQDNMACRO = "{DomainFqdn}"
155+
$AzureLocalPortalDomain = "https://portal.$DOMAINFQDNMACRO"
156+
154157
$AzureCloud = "AzureCloud"
155158
$AzureChinaCloud = "AzureChinaCloud"
156159
$AzureUSGovernment = "AzureUSGovernment"
157160
$AzureGermanCloud = "AzureGermanCloud"
158161
$AzurePPE = "AzurePPE"
159162
$AzureCanary = "AzureCanary"
163+
$AzureLocal = "Azure.local"
160164

161165
$PortalCanarySuffix = '?feature.armendpointprefix={0}'
162166
$PortalHCIResourceUrl = '#@{0}/resource/subscriptions/{1}/resourceGroups/{2}/providers/Microsoft.AzureStackHCI/clusters/{3}/overview'
@@ -196,6 +200,11 @@ $AuthorityAzureGermanCloud = "https://login.microsoftonline.de"
196200
$BillingServiceApiScopeAzureGermanCloud = "https://azurestackhci-usage.azurewebsites.de/.default"
197201
$GraphServiceApiScopeAzureGermanCloud = "https://graph.cloudapi.de/.default"
198202

203+
$ServiceEndpointAzureLocal = "https://dp.aszrp.$DOMAINFQDNMACRO"
204+
$AuthorityAzureLocal = "https://login.$DOMAINFQDNMACRO"
205+
$BillingServiceApiScopeAzureLocal = "https://dp.aszrp.$DOMAINFQDNMACRO/.default"
206+
$GraphServiceApiScopeAzureLocal = "https://graph.$DOMAINFQDNMACRO"
207+
199208
$RPAPIVersion = "2022-12-01";
200209
$HCIArcAPIVersion = "2023-03-01"
201210
$HCIArcExtensionAPIVersion = "2021-09-01"
@@ -1029,6 +1038,10 @@ param(
10291038
$PortalCanarySuffixWithRegion = $PortalCanarySuffix -f $Region
10301039
return ($AzureCanaryPortalDomain + $PortalCanarySuffixWithRegion);
10311040
}
1041+
elseif($EnvironmentName -eq $AzureLocal)
1042+
{
1043+
return $AzureLocalPortalDomain;
1044+
}
10321045
}
10331046

10341047
function Get-DefaultRegion{
@@ -1063,6 +1076,10 @@ param(
10631076
{
10641077
$defaultRegion = "eastus2euap"
10651078
}
1079+
elseif($EnvironmentName -eq $AzureLocal)
1080+
{
1081+
$defaultRegion = "autonomous"
1082+
}
10661083

10671084
return $defaultRegion
10681085
}
@@ -1130,6 +1147,13 @@ param(
11301147
$BillingServiceApiScope.Value = $BillingServiceApiScopeAzurePPE
11311148
$GraphServiceApiScope.Value = $GraphServiceApiScopeAzurePPE
11321149
}
1150+
elseif($EnvironmentName -eq $AzureLocal)
1151+
{
1152+
$ServiceEndpoint.Value = $ServiceEndpointAzureLocal
1153+
$Authority.Value = $AuthorityAzureLocal
1154+
$BillingServiceApiScope.Value = $BillingServiceApiScopeAzureLocal
1155+
$GraphServiceApiScope.Value = $GraphServiceApiScopeAzureLocal
1156+
}
11331157
}
11341158

11351159

@@ -1409,6 +1433,39 @@ param(
14091433
return $regionName
14101434
}
14111435

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+
14121469
function Validate-RegionName{
14131470
[Microsoft.Azure.PowerShell.Cmdlets.StackHCI.DoNotExportAttribute()]
14141471
param(
@@ -2895,6 +2952,12 @@ param(
28952952
Write-VerboseLog ("Cloud Management Infra supported: {0}" -f $isCloudManagementInfraSupported)
28962953
Write-VerboseLog ("Installing Mandatory extensions supported: {0}" -f $isDefaultExtensionSupported)
28972954

2955+
if ($EnvironmentName -eq $AzureLocal)
2956+
{
2957+
Write-VerboseLog ("Registering in Azure Local. Initiliazing Azure.local configurations")
2958+
Initialize-AzureLocalConfig
2959+
}
2960+
28982961
if(-Not ([string]::IsNullOrEmpty($RegContext.AzureResourceUri)))
28992962
{
29002963
if([string]::IsNullOrEmpty($ResourceName))
@@ -4181,31 +4244,34 @@ param(
41814244
$TenantId = Azure-Login -SubscriptionId $SubscriptionId -TenantId $TenantId -ArmAccessToken $ArmAccessToken -GraphAccessToken $GraphAccessToken -AccountId $AccountId -EnvironmentName $EnvironmentName -ProgressActivityName $UnregisterProgressActivityName -UseDeviceAuthentication $UseDeviceAuthentication -Region $Region
41824245

41834246
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)
41994249
{
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)
42014253
{
4202-
$resultValue = [OperationStatus]::Success
4254+
$resultValue = [OperationStatus]::Failed
4255+
$unregisterArcForServersWacErrorCode = 9117
42034256
$unregistrationOutput | Add-Member -MemberType NoteProperty -Name $OutputPropertyResult -Value $resultValue
42044257
Set-WacOutputProperty -IsWAC $IsWAC -PropertyName $OutputPropertyWacResult -PropertyValue $resultValue.ToString() -Output $unregistrationOutput
4258+
Set-WacOutputProperty -IsWAC $IsWAC -PropertyName $OutputPropertyWacErrorCode -PropertyValue $unregisterArcForServersWacErrorCode -Output $unregistrationOutput
42054259
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
42074261
return
42084262
}
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+
}
42094275
}
42104276

42114277
Write-Progress -Id $MainProgressBarId -activity $UnregisterProgressActivityName -status $UnregisterHCIUsageMessage -percentcomplete 45

src/StackHCI/StackHCI/Az.StackHCI.psd1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 7/31/2024
6+
# Generated on: 10/10/2024
77
#
88

99
@{
@@ -51,16 +51,16 @@ DotNetFrameworkVersion = '4.7.2'
5151
# ProcessorArchitecture = ''
5252

5353
# Modules that must be imported into the global environment prior to importing this module
54-
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.3'; })
54+
RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '3.0.4'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
5757
RequiredAssemblies = 'StackHCI.Autorest/bin/Az.StackHCI.private.dll'
5858

5959
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60-
# ScriptsToProcess = @()
60+
ScriptsToProcess = @()
6161

6262
# Type files (.ps1xml) to be loaded when importing this module
63-
# TypesToProcess = @()
63+
TypesToProcess = @()
6464

6565
# Format files (.ps1xml) to be loaded when importing this module
6666
FormatsToProcess = 'StackHCI.Autorest/Az.StackHCI.format.ps1xml'
@@ -121,7 +121,7 @@ PrivateData = @{
121121
PSData = @{
122122

123123
# Tags applied to this module. These help with module discovery in online galleries.
124-
Tags = 'Azure','ResourceManager','ARM','PSModule','StackHci'
124+
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'StackHci'
125125

126126
# A URL to the license for this module.
127127
LicenseUri = 'https://aka.ms/azps-license'
@@ -147,7 +147,7 @@ PrivateData = @{
147147

148148
} # End of PSData hashtable
149149

150-
} # End of PrivateData hashtable
150+
} # End of PrivateData hashtable
151151

152152
# HelpInfo URI of this module
153153
# HelpInfoURI = ''

src/StackHCI/StackHCI/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* added support for new environment
2122

2223
## Version 2.4.0
2324
* Upgraded API version to 2024-04-01

src/StackHCI/StackHCI/help/Add-AzStackHCIVMAttestation.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ Add-AzStackHCIVMAttestation configures guests for AzureStack HCI IMDS Attestatio
1414

1515
### VMName (Default)
1616
```
17-
Add-AzStackHCIVMAttestation [-VMName] <String[]> [-Force] [-WhatIf]
17+
Add-AzStackHCIVMAttestation [-VMName] <String[]> [-Force] [-ProgressAction <ActionPreference>] [-WhatIf]
1818
[-Confirm] [<CommonParameters>]
1919
```
2020

2121
### VMObject
2222
```
23-
Add-AzStackHCIVMAttestation [-Force] [-VM] <Object[]> [-WhatIf] [-Confirm]
23+
Add-AzStackHCIVMAttestation [-Force] [-VM] <Object[]> [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
2424
[<CommonParameters>]
2525
```
2626

2727
### AddAll
2828
```
29-
Add-AzStackHCIVMAttestation [-Force] [-AddAll] [-WhatIf] [-Confirm]
29+
Add-AzStackHCIVMAttestation [-Force] [-AddAll] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
3030
[<CommonParameters>]
3131
```
3232

@@ -107,6 +107,21 @@ Accept pipeline input: False
107107
Accept wildcard characters: False
108108
```
109109
110+
### -ProgressAction
111+
{{ Fill ProgressAction Description }}
112+
113+
```yaml
114+
Type: System.Management.Automation.ActionPreference
115+
Parameter Sets: (All)
116+
Aliases: proga
117+
118+
Required: False
119+
Position: Named
120+
Default value: None
121+
Accept pipeline input: False
122+
Accept wildcard characters: False
123+
```
124+
110125
### -VM
111126
Specifies an array of VM objects from Get-VM.
112127

src/StackHCI/StackHCI/help/Disable-AzStackHCIAttestation.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Disable-AzStackHCIAttestation disables IMDS Attestation on the host
1414

1515
```
1616
Disable-AzStackHCIAttestation [[-ComputerName] <String>] [-Credential <PSCredential>] [-RemoveVM] [-Force]
17-
[-WhatIf] [-Confirm] [<CommonParameters>]
17+
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -83,6 +83,21 @@ Accept pipeline input: False
8383
Accept wildcard characters: False
8484
```
8585
86+
### -ProgressAction
87+
{{ Fill ProgressAction Description }}
88+
89+
```yaml
90+
Type: System.Management.Automation.ActionPreference
91+
Parameter Sets: (All)
92+
Aliases: proga
93+
94+
Required: False
95+
Position: Named
96+
Default value: None
97+
Accept pipeline input: False
98+
Accept wildcard characters: False
99+
```
100+
86101
### -RemoveVM
87102
Specifies the guests on each node should be removed from IMDS Attestation before disabling on cluster.
88103
Disable cannot continue before guests are removed.

src/StackHCI/StackHCI/help/Disable-AzStackHCIRemoteSupport.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Disables Remote Support.
1313
## SYNTAX
1414

1515
```
16-
Disable-AzStackHCIRemoteSupport [-WhatIf] [-Confirm] [<CommonParameters>]
16+
Disable-AzStackHCIRemoteSupport [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
1717
```
1818

1919
## DESCRIPTION
@@ -37,6 +37,21 @@ Disabling Remort support
3737

3838
## PARAMETERS
3939

40+
### -ProgressAction
41+
{{ Fill ProgressAction Description }}
42+
43+
```yaml
44+
Type: System.Management.Automation.ActionPreference
45+
Parameter Sets: (All)
46+
Aliases: proga
47+
48+
Required: False
49+
Position: Named
50+
Default value: None
51+
Accept pipeline input: False
52+
Accept wildcard characters: False
53+
```
54+
4055
### -Confirm
4156
Prompts you for confirmation before running the cmdlet.
4257

src/StackHCI/StackHCI/help/Enable-AzStackHCIAttestation.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Enable-AzStackHCIAttestation configures the host and enables specified guests fo
1414

1515
```
1616
Enable-AzStackHCIAttestation [[-ComputerName] <String>] [-Credential <PSCredential>] [-AddVM] [-Force]
17-
[-WhatIf] [-Confirm] [<CommonParameters>]
17+
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -99,6 +99,21 @@ Accept pipeline input: False
9999
Accept wildcard characters: False
100100
```
101101
102+
### -ProgressAction
103+
{{ Fill ProgressAction Description }}
104+
105+
```yaml
106+
Type: System.Management.Automation.ActionPreference
107+
Parameter Sets: (All)
108+
Aliases: proga
109+
110+
Required: False
111+
Position: Named
112+
Default value: None
113+
Accept pipeline input: False
114+
Accept wildcard characters: False
115+
```
116+
102117
### -Confirm
103118
Prompts you for confirmation before running the cmdlet.
104119

src/StackHCI/StackHCI/help/Enable-AzStackHCIRemoteSupport.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Enables Remote Support.
1414

1515
```
1616
Enable-AzStackHCIRemoteSupport [-AccessLevel] <String> [[-ExpireInMinutes] <Int32>] [[-SasCredential] <String>]
17-
[-AgreeToRemoteSupportConsent] [-WhatIf] [-Confirm] [<CommonParameters>]
17+
[-AgreeToRemoteSupportConsent] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -118,6 +118,21 @@ Accept pipeline input: False
118118
Accept wildcard characters: False
119119
```
120120
121+
### -ProgressAction
122+
{{ Fill ProgressAction Description }}
123+
124+
```yaml
125+
Type: System.Management.Automation.ActionPreference
126+
Parameter Sets: (All)
127+
Aliases: proga
128+
129+
Required: False
130+
Position: Named
131+
Default value: None
132+
Accept pipeline input: False
133+
Accept wildcard characters: False
134+
```
135+
121136
### -SasCredential
122137
Hybrid Connection SAS Credential.
123138

0 commit comments

Comments
 (0)