diff --git a/src/StackHCI/StackHCI.Autorest/README.md b/src/StackHCI/StackHCI.Autorest/README.md index fb50e3a46a81..700e9cc600ca 100644 --- a/src/StackHCI/StackHCI.Autorest/README.md +++ b/src/StackHCI/StackHCI.Autorest/README.md @@ -3,9 +3,6 @@ This directory contains the PowerShell module for the StackHci service. --- -## Status -[![Az.StackHCI](https://img.shields.io/powershellgallery/v/Az.StackHCI.svg?style=flat-square&label=Az.StackHCI "Az.StackHCI")](https://www.powershellgallery.com/packages/Az.StackHCI/) - ## Info - Modifiable: yes - Generated: all diff --git a/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 b/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 index 4c7cce42538a..4990379ae2af 100644 --- a/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 +++ b/src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1 @@ -4723,7 +4723,6 @@ param( $nodeSessionParams = @{} $subscriptionId = [string]::Empty $armResourceId = [string]::Empty - $armResource = $null $successMessage = New-Object -TypeName System.Text.StringBuilder @@ -4845,50 +4844,36 @@ param( $TenantId = Azure-Login @azureLoginParameters } - $armResource = Get-AzResource -ResourceId $armResourceId -ExpandProperties -ApiVersion $RPAPIVersion -ErrorAction Stop - $properties = [PSCustomObject]@{ - desiredProperties = $armResource.Properties.desiredProperties - aadClientId = $armResource.Properties.aadClientId - aadTenantId = $armResource.Properties.aadTenantId - aadServicePrincipalObjectId = $armResource.Properties.aadServicePrincipalObjectId - aadApplicationObjectId = $armResource.Properties.aadApplicationObjectId - } - - if ($properties.desiredProperties -eq $null) - { - # - # Create desiredProperties object with default values - # - $desiredProperties = New-Object -TypeName PSObject - $desiredProperties | Add-Member -MemberType NoteProperty -Name 'windowsServerSubscription' -Value 'Disabled' - $desiredProperties | Add-Member -MemberType NoteProperty -Name 'diagnosticLevel' -Value 'Basic' - - $properties | Add-Member -MemberType NoteProperty -Name 'desiredProperties' -Value $desiredProperties + desiredProperties = New-Object -TypeName PSObject } if ($PSBoundParameters.ContainsKey('EnableWSSubscription')) { + $windowsServerSubscriptionValue = $Null + if ($EnableWSSubscription -eq $true) { - $properties.desiredProperties.windowsServerSubscription = 'Enabled'; + $windowsServerSubscriptionValue = 'Enabled'; $successMessage.Append($SetAzResourceSuccessWSSE) | Out-Null; } else { - $properties.desiredProperties.windowsServerSubscription = 'Disabled'; + $windowsServerSubscriptionValue = 'Disabled'; $successMessage.Append($SetAzResourceSuccessWSSD) | Out-Null; } + $properties.desiredProperties | Add-Member -MemberType NoteProperty -Name 'windowsServerSubscription' -Value $windowsServerSubscriptionValue + $doSetResource = $true $needShouldContinue = $true } if ($PSBoundParameters.ContainsKey('DiagnosticLevel')) { - $properties.desiredProperties.diagnosticLevel = $DiagnosticLevel.ToString() + $properties.desiredProperties | Add-Member -MemberType NoteProperty -Name 'diagnosticLevel' -Value $($DiagnosticLevel.ToString()) if ($successMessage.Length -gt 0) { @@ -4917,12 +4902,12 @@ param( Write-Progress -Id $MainProgressBarId -Activity $SetProgressActivityName -Status $SetProgressStatusUpdatingProps -PercentComplete 60 $setAzResourceParameters = @{ - 'ResourceId' = $armResource.Id; + 'ResourceId' = $armResourceId; 'Properties' = $properties; 'ApiVersion' = $RPAPIVersion } - $localResult = Set-AzResource @setAzResourceParameters -Confirm:$false -Force -ErrorAction Stop + $localResult = Set-AzResource @setAzResourceParameters -UsePatchSemantics -Confirm:$false -Force -ErrorAction Stop if ($PSBoundParameters.ContainsKey('EnableWSSubscription') -and ($EnableWSSubscription -eq $false)) { diff --git a/src/StackHCI/StackHCI/Az.StackHCI.psd1 b/src/StackHCI/StackHCI/Az.StackHCI.psd1 index 0f0375dcc5d0..4914c0d4baf5 100644 --- a/src/StackHCI/StackHCI/Az.StackHCI.psd1 +++ b/src/StackHCI/StackHCI/Az.StackHCI.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 2/19/2024 +# Generated on: 2/21/2024 # @{