Skip to content

Migrate StackHCI from generation to release-2023-03-07 #21123

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

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/StackHCI/Az.StackHCI.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2/27/2023
# Generated on: 3/6/2023
#

@{
Expand Down
70 changes: 35 additions & 35 deletions src/StackHCI/StackHCI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{39174213-6C80-4987-AB0C-43CAA3669F3F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{6D183BC1-503C-4357-9CFE-E6D8C0D1091B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{F095DE48-C362-43CA-BDDD-A119920A9E7D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{8C4ECCBD-F72F-45E5-9A70-FB975D51DD65}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{F52158AF-C78E-4765-8721-2C9E6778B323}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{2D65ADE5-8256-40F0-8C61-80A3A7B1DD06}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{01D7BE19-D97F-4730-B5D2-4B410BBD3CD2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{C6DA5CD7-9FEB-4150-A3FD-BC7B6621196E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{81A759B1-754A-4C82-97A2-439646980C02}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{2398CFBE-7C62-4CEF-BDA9-071EB9E3AEAC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{435F721E-3CCE-493A-8430-BC1AEA382139}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{D55AD32F-4CE5-44B0-8D51-865C832CE0EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.StackHCI", "Az.StackHCI.csproj", "{DAC22DDC-D376-4A68-B6E7-2101556F08ED}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.StackHCI", "Az.StackHCI.csproj", "{3FF7A9CD-CD48-421B-838C-A2EDAEE4E9A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -26,33 +26,33 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{39174213-6C80-4987-AB0C-43CAA3669F3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39174213-6C80-4987-AB0C-43CAA3669F3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39174213-6C80-4987-AB0C-43CAA3669F3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39174213-6C80-4987-AB0C-43CAA3669F3F}.Release|Any CPU.Build.0 = Release|Any CPU
{F095DE48-C362-43CA-BDDD-A119920A9E7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F095DE48-C362-43CA-BDDD-A119920A9E7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F095DE48-C362-43CA-BDDD-A119920A9E7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F095DE48-C362-43CA-BDDD-A119920A9E7D}.Release|Any CPU.Build.0 = Release|Any CPU
{F52158AF-C78E-4765-8721-2C9E6778B323}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F52158AF-C78E-4765-8721-2C9E6778B323}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F52158AF-C78E-4765-8721-2C9E6778B323}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F52158AF-C78E-4765-8721-2C9E6778B323}.Release|Any CPU.Build.0 = Release|Any CPU
{01D7BE19-D97F-4730-B5D2-4B410BBD3CD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01D7BE19-D97F-4730-B5D2-4B410BBD3CD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01D7BE19-D97F-4730-B5D2-4B410BBD3CD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01D7BE19-D97F-4730-B5D2-4B410BBD3CD2}.Release|Any CPU.Build.0 = Release|Any CPU
{81A759B1-754A-4C82-97A2-439646980C02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81A759B1-754A-4C82-97A2-439646980C02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81A759B1-754A-4C82-97A2-439646980C02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81A759B1-754A-4C82-97A2-439646980C02}.Release|Any CPU.Build.0 = Release|Any CPU
{435F721E-3CCE-493A-8430-BC1AEA382139}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{435F721E-3CCE-493A-8430-BC1AEA382139}.Debug|Any CPU.Build.0 = Debug|Any CPU
{435F721E-3CCE-493A-8430-BC1AEA382139}.Release|Any CPU.ActiveCfg = Release|Any CPU
{435F721E-3CCE-493A-8430-BC1AEA382139}.Release|Any CPU.Build.0 = Release|Any CPU
{DAC22DDC-D376-4A68-B6E7-2101556F08ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DAC22DDC-D376-4A68-B6E7-2101556F08ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAC22DDC-D376-4A68-B6E7-2101556F08ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DAC22DDC-D376-4A68-B6E7-2101556F08ED}.Release|Any CPU.Build.0 = Release|Any CPU
{6D183BC1-503C-4357-9CFE-E6D8C0D1091B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D183BC1-503C-4357-9CFE-E6D8C0D1091B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D183BC1-503C-4357-9CFE-E6D8C0D1091B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D183BC1-503C-4357-9CFE-E6D8C0D1091B}.Release|Any CPU.Build.0 = Release|Any CPU
{8C4ECCBD-F72F-45E5-9A70-FB975D51DD65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C4ECCBD-F72F-45E5-9A70-FB975D51DD65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C4ECCBD-F72F-45E5-9A70-FB975D51DD65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C4ECCBD-F72F-45E5-9A70-FB975D51DD65}.Release|Any CPU.Build.0 = Release|Any CPU
{2D65ADE5-8256-40F0-8C61-80A3A7B1DD06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D65ADE5-8256-40F0-8C61-80A3A7B1DD06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D65ADE5-8256-40F0-8C61-80A3A7B1DD06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D65ADE5-8256-40F0-8C61-80A3A7B1DD06}.Release|Any CPU.Build.0 = Release|Any CPU
{C6DA5CD7-9FEB-4150-A3FD-BC7B6621196E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6DA5CD7-9FEB-4150-A3FD-BC7B6621196E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6DA5CD7-9FEB-4150-A3FD-BC7B6621196E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6DA5CD7-9FEB-4150-A3FD-BC7B6621196E}.Release|Any CPU.Build.0 = Release|Any CPU
{2398CFBE-7C62-4CEF-BDA9-071EB9E3AEAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2398CFBE-7C62-4CEF-BDA9-071EB9E3AEAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2398CFBE-7C62-4CEF-BDA9-071EB9E3AEAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2398CFBE-7C62-4CEF-BDA9-071EB9E3AEAC}.Release|Any CPU.Build.0 = Release|Any CPU
{D55AD32F-4CE5-44B0-8D51-865C832CE0EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D55AD32F-4CE5-44B0-8D51-865C832CE0EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D55AD32F-4CE5-44B0-8D51-865C832CE0EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D55AD32F-4CE5-44B0-8D51-865C832CE0EC}.Release|Any CPU.Build.0 = Release|Any CPU
{3FF7A9CD-CD48-421B-838C-A2EDAEE4E9A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FF7A9CD-CD48-421B-838C-A2EDAEE4E9A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FF7A9CD-CD48-421B-838C-A2EDAEE4E9A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FF7A9CD-CD48-421B-838C-A2EDAEE4E9A7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions src/StackHCI/build-module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ $null = New-Item -ItemType Directory -Force -Path $examplesFolder

Write-Host -ForegroundColor Green 'Creating cmdlets for specified models...'
$modelCmdlets = @()
$modelCmdletFolder = Join-Path (Join-Path $PSScriptRoot './custom') 'autogen-model-cmdlets'
if (Test-Path $modelCmdletFolder) {
$null = Remove-Item -Force -Recurse -Path $modelCmdletFolder
}
if ($modelCmdlets.Count -gt 0) {
. (Join-Path $PSScriptRoot 'create-model-cmdlets.ps1')
CreateModelCmdlet($modelCmdlets)
Expand Down
12 changes: 8 additions & 4 deletions src/StackHCI/create-model-cmdlets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ function CreateModelCmdlet {
}

$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
$ModuleName = 'StackHCI'
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
$null = New-Item -ItemType Directory -Force -Path $OutputDir
if (''.length -gt 0) {
$ModuleName = ''
} else {
$ModuleName = 'Az.StackHCI'
}

$CsFiles = Get-ChildItem -Path $ModelCsPath -Recurse -Filter *.cs
$Content = ''
Expand Down Expand Up @@ -64,10 +68,10 @@ function CreateModelCmdlet {
$ObjectType = $Model
$ObjectTypeWithNamespace = "${Namespace}.${ObjectType}"
# remove duplicated module name
if ($ObjectType.StartsWith($ModuleName)) {
if ($ObjectType.StartsWith('StackHCI')) {
$ModulePrefix = ''
} else {
$ModulePrefix = $ModuleName
$ModulePrefix = 'StackHCI'
}
$OutputPath = Join-Path -ChildPath "New-Az${ModulePrefix}${ObjectType}Object.ps1" -Path $OutputDir

Expand Down Expand Up @@ -158,7 +162,7 @@ Create an in-memory object for ${ObjectType}.
.Outputs
${ObjectTypeWithNamespace}
.Link
https://learn.microsoft.com/powershell/module/az.${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
https://learn.microsoft.com/powershell/module/${ModuleName}/new-Az${ModulePrefix}${ObjectType}Object
#>
function New-Az${ModulePrefix}${ObjectType}Object {
[OutputType('${ObjectTypeWithNamespace}')]
Expand Down
111 changes: 69 additions & 42 deletions src/StackHCI/custom/stackhci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ $ArcIntegrationNotAvailableForCloudError = "Azure Arc for Server integration is
$ArcNeedsToBeEnabledError = "Azure Arc for servers integration can't be disabled. Skip the parameter '-EnableAzureArcServer' or Specify '-EnableAzureArcServer:`$true' in Register-AzStackHCI Cmdlet to register."
$ArcAADAppCreationMessage= "Creating AAD application for onboarding ARC"
$FetchingRegistrationState = "Checking whether the cluster is already registered"
$CheckingDependentModules = "Checking whether the required modules are installed"
$ValidatingParametersFetchClusterName = "Validating cmdlet parameters"
$ValidatingParametersRegisteredInfo = "Validating the parameters and checking registration information"
$RegisterProgressActivityName = "Registering Azure Stack HCI with Azure..."
Expand Down Expand Up @@ -77,6 +78,7 @@ $VerifyingArcMessage = "Verifying Azure Arc for Servers registration"
$WaitingUnregisterMessage = "Disabling Azure Arc integration on every clustered node"
$CleanArcMessage = "Cleaning up Azure Arc integration"

$MissingDependentModulesError = "Can't find PowerShell module(s): {0}. Please install the missing module(s) using 'Install-Module -Name <Module_Name>' and try again."
$ArcAlreadyEnabledInADifferentResourceError = "Below mentioned cluster node(s) are already Arc enabled with a different ARM Resource Id:`n{0}`nDisconnect Arc agent on these nodes and run Register-AzStackHCI again."

$ArcAgentRolesInsufficientPreviligeMessage = "Failed to assign required roles for Azure Arc integration. Your Azure AD account must be an Owner or User Access Administrator in the subscription to enable Azure Arc integration."
Expand Down Expand Up @@ -242,8 +244,8 @@ $ArcSettingsDisableInProgressState = "DisableInProgress"
$ClusterAgentServiceName = "HciClusterAgentSvc"
$ClusterAgentGroupName = "Cloud Management"

$AzAccountsModuleVersion="2.10.2"
$AzResourcesModuleVersion="6.2.0"
$AzAccountsModuleMinVersion="2.11.2"
$AzResourcesModuleMinVersion="6.2.0"

Function Write-Log {
[Microsoft.Azure.PowerShell.Cmdlets.StackHCI.DoNotExportAttribute()]
Expand Down Expand Up @@ -932,33 +934,65 @@ param(
return "/Subscriptions/" + $SubscriptionId + "/resourceGroups/" + $ResourceGroupName + "/providers/Microsoft.AzureStackHCI/clusters/" + $ResourceName
}

function Install-Dependent-Module{
param(
[string] $ModuleName,
[string] $ModuleVersion
function Import-DependentModule
{
param (
[string] $ModuleName,
[string] $MinVersion
)
try
$module = Get-Module -Name $ModuleName
if ((-not $module) -or ($module.Version -lt [System.Version]$MinVersion))
{
Import-Module -Name $ModuleName -RequiredVersion $ModuleVersion -ErrorAction Stop
Write-VerboseLog ("Found required Module: {0} version: {1}" -f $ModuleName,$ModuleVersion)
}
catch
{
try
Write-VerboseLog "Required module $ModuleName (minimum version: $MinVersion) is not imported"
try
{
Import-PackageProvider -Name Nuget -MinimumVersion "2.8.5.201" -ErrorAction Stop
# Adding this statement to clear all the versions that exist in the current PS session
Remove-Module -Name $ModuleName -ErrorAction Ignore

Import-Module -Name $ModuleName -MinimumVersion $MinVersion
}
catch
{
Install-PackageProvider NuGet -Force | Out-Null
Write-WarnLog "$_.Exception"
Write-VerboseLog "Required module $ModuleName (minimum version: $MinVersion) is missing"
throw ("$ModuleName (minimum version: $MinVersion)")
}
}
}

Write-VerboseLog ("Installing Module: {0} version: {1}" -f $ModuleName,$ModuleVersion)
function Check-DependentModules
{
param()

Install-Module -Name $ModuleName -RequiredVersion $ModuleVersion -Force -AllowClobber -Repository 'PSGallery'
Import-Module -Name $ModuleName -RequiredVersion $ModuleVersion

Write-VerboseLog ("Successfully imported Module: {0} version: {1}" -f $ModuleName,$ModuleVersion)
$missingDependentModules = [System.Collections.ArrayList]::new()

# Checking if Az.Accounts is imported
try
{
Write-VerboseLog "Importing dependent module Az.Accounts"
Import-DependentModule -ModuleName "Az.Accounts" -MinVersion $AzAccountsModuleMinVersion
}
catch
{
$missingDependentModules.Add($_.Exception.Message) | Out-Null
}

# Checking if Az.Resources is imported
try
{
Write-VerboseLog "Importing dependent module Az.Resources"
Import-DependentModule -ModuleName "Az.Resources" -MinVersion $AzResourcesModuleMinVersion
}
catch
{
$missingDependentModules.Add($_.Exception.Message) | Out-Null
}

if($missingDependentModules.Length -gt 0)
{
$missingDependentModules = $missingDependentModules -join ", "
$MissingDependentModulesExceptionMessage = $MissingDependentModulesError -f $missingDependentModules
throw $MissingDependentModulesExceptionMessage
}
}

Expand All @@ -977,9 +1011,7 @@ param(
)

Write-Progress -Id $MainProgressBarId -activity $ProgressActivityName -status $InstallAzResourcesMessage -percentcomplete 10

Install-Dependent-Module -ModuleName "Az.Accounts" -ModuleVersion $AzAccountsModuleVersion
Install-Dependent-Module -ModuleName "Az.Resources" -ModuleVersion $AzResourcesModuleVersion

Write-Progress -Id $MainProgressBarId -activity $ProgressActivityName -status $LoggingInToAzureMessage -percentcomplete 30

if($EnvironmentName -eq $AzurePPE)
Expand Down Expand Up @@ -2438,15 +2470,6 @@ param(
$registrationOutput = New-Object -TypeName PSObject
$operationStatus = [OperationStatus]::Unused

try
{
Import-PackageProvider -Name Nuget -MinimumVersion "2.8.5.201" -ErrorAction Stop
}
catch
{
Install-PackageProvider NuGet -Force | Out-Null
}

Show-LatestModuleVersion

if([string]::IsNullOrEmpty($ComputerName))
Expand All @@ -2459,7 +2482,10 @@ param(
$IsManagementNode = $True
}

Write-Progress -Id $MainProgressBarId -activity $RegisterProgressActivityName -status $FetchingRegistrationState -percentcomplete 1
Write-Progress -Id $MainProgressBarId -activity $RegisterProgressActivityName -status $CheckingDependentModules -percentcomplete 1
Check-DependentModules

Write-Progress -Id $MainProgressBarId -activity $RegisterProgressActivityName -status $FetchingRegistrationState -percentcomplete 2
if($IsManagementNode)
{
Write-VerboseLog ("Connecting via Management Node")
Expand Down Expand Up @@ -3546,8 +3572,10 @@ param(
Write-VerboseLog ("Overriding RP API version for MC cloud to 2022-09-01")
$RPAPIVersion = "2022-09-01"
}

Write-Progress -Id $MainProgressBarId -activity $UnregisterProgressActivityName -status $FetchingRegistrationState -percentcomplete 1
Write-Progress -Id $MainProgressBarId -activity $UnregisterProgressActivityName -status $CheckingDependentModules -percentcomplete 1
Check-DependentModules

Write-Progress -Id $MainProgressBarId -activity $UnregisterProgressActivityName -status $FetchingRegistrationState -percentcomplete 2
Write-VerboseLog ($UnregisterProgressActivityName)
$msg = Print-FunctionParameters -Message "Unregister-AzStackHCI" -Parameters $PSBoundParameters
Write-NodeEventLog -Message $msg -EventID 9009 -IsManagementNode $IsManagementNode -credentials $Credential -ComputerName $ComputerName
Expand Down Expand Up @@ -4167,14 +4195,18 @@ param(
{
$isManagementNode = $true
}

# To be removed after ARM rollout to MC cloud is complete
if ( $EnvironmentName -eq $AzureChinaCloud)
{
Write-VerboseLog ("Overriding RP API version for MC cloud to 2022-09-01")
$RPAPIVersion = "2022-09-01"
}


Write-Progress -Id $MainProgressBarId -Activity $SetProgressActivityName -Status $CheckingDependentModules -PercentComplete 2
Check-DependentModules


Write-Progress -Id $MainProgressBarId -Activity $SetProgressActivityName -Status $SetProgressStatusGathering -PercentComplete 5

if($PSBoundParameters.ContainsKey('ResourceId') -eq $false)
Expand Down Expand Up @@ -4283,11 +4315,6 @@ param(

$TenantId = Azure-Login @azureLoginParameters
}
else
{
Install-Dependent-Module -ModuleName "Az.Accounts" -ModuleVersion $AzAccountsModuleVersion
Install-Dependent-Module -ModuleName "Az.Resources" -ModuleVersion $AzResourcesModuleVersion
}

$armResource = Get-AzResource -ResourceId $armResourceId -ExpandProperties -ApiVersion $RPAPIVersion -ErrorAction Stop

Expand Down
2 changes: 1 addition & 1 deletion src/StackHCI/exports/Add-AzStackHCIVMAttestation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ begin {
$parameterSet = $PSCmdlet.ParameterSetName

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString()
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
}
$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
if ($preTelemetryId -eq '') {
Expand Down
2 changes: 1 addition & 1 deletion src/StackHCI/exports/Disable-AzStackHCIAttestation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ begin {
$parameterSet = $PSCmdlet.ParameterSetName

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $Host.Version.ToString()
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
}
$preTelemetryId = [Microsoft.WindowsAzure.Commands.Common.MetricHelper]::TelemetryId
if ($preTelemetryId -eq '') {
Expand Down
Loading