@@ -4723,7 +4723,6 @@ param(
4723
4723
$nodeSessionParams = @ {}
4724
4724
$subscriptionId = [string ]::Empty
4725
4725
$armResourceId = [string ]::Empty
4726
- $armResource = $null
4727
4726
4728
4727
$successMessage = New-Object - TypeName System.Text.StringBuilder
4729
4728
@@ -4845,50 +4844,36 @@ param(
4845
4844
$TenantId = Azure- Login @azureLoginParameters
4846
4845
}
4847
4846
4848
- $armResource = Get-AzResource - ResourceId $armResourceId - ExpandProperties - ApiVersion $RPAPIVersion - ErrorAction Stop
4849
-
4850
4847
$properties = [PSCustomObject ]@ {
4851
- desiredProperties = $armResource.Properties.desiredProperties
4852
- aadClientId = $armResource.Properties.aadClientId
4853
- aadTenantId = $armResource.Properties.aadTenantId
4854
- aadServicePrincipalObjectId = $armResource.Properties.aadServicePrincipalObjectId
4855
- aadApplicationObjectId = $armResource.Properties.aadApplicationObjectId
4856
- }
4857
-
4858
- if ($properties.desiredProperties -eq $null )
4859
- {
4860
- #
4861
- # Create desiredProperties object with default values
4862
- #
4863
- $desiredProperties = New-Object - TypeName PSObject
4864
- $desiredProperties | Add-Member - MemberType NoteProperty - Name ' windowsServerSubscription' - Value ' Disabled'
4865
- $desiredProperties | Add-Member - MemberType NoteProperty - Name ' diagnosticLevel' - Value ' Basic'
4866
-
4867
- $properties | Add-Member - MemberType NoteProperty - Name ' desiredProperties' - Value $desiredProperties
4848
+ desiredProperties = New-Object - TypeName PSObject
4868
4849
}
4869
4850
4870
4851
if ($PSBoundParameters.ContainsKey (' EnableWSSubscription' ))
4871
4852
{
4853
+ $windowsServerSubscriptionValue = $Null
4854
+
4872
4855
if ($EnableWSSubscription -eq $true )
4873
4856
{
4874
- $properties .desiredProperties.windowsServerSubscription = ' Enabled' ;
4857
+ $windowsServerSubscriptionValue = ' Enabled' ;
4875
4858
4876
4859
$successMessage.Append ($SetAzResourceSuccessWSSE ) | Out-Null ;
4877
4860
}
4878
4861
else
4879
4862
{
4880
- $properties .desiredProperties.windowsServerSubscription = ' Disabled' ;
4863
+ $windowsServerSubscriptionValue = ' Disabled' ;
4881
4864
4882
4865
$successMessage.Append ($SetAzResourceSuccessWSSD ) | Out-Null ;
4883
4866
}
4884
4867
4868
+ $properties.desiredProperties | Add-Member - MemberType NoteProperty - Name ' windowsServerSubscription' - Value $windowsServerSubscriptionValue
4869
+
4885
4870
$doSetResource = $true
4886
4871
$needShouldContinue = $true
4887
4872
}
4888
4873
4889
4874
if ($PSBoundParameters.ContainsKey (' DiagnosticLevel' ))
4890
4875
{
4891
- $properties.desiredProperties. diagnosticLevel = $ DiagnosticLevel.ToString ()
4876
+ $properties.desiredProperties | Add-Member - MemberType NoteProperty - Name ' diagnosticLevel' - Value $ ( $ DiagnosticLevel.ToString () )
4892
4877
4893
4878
if ($successMessage.Length -gt 0 )
4894
4879
{
@@ -4917,12 +4902,12 @@ param(
4917
4902
Write-Progress - Id $MainProgressBarId - Activity $SetProgressActivityName - Status $SetProgressStatusUpdatingProps - PercentComplete 60
4918
4903
4919
4904
$setAzResourceParameters = @ {
4920
- ' ResourceId' = $armResource .Id ;
4905
+ ' ResourceId' = $armResourceId ;
4921
4906
' Properties' = $properties ;
4922
4907
' ApiVersion' = $RPAPIVersion
4923
4908
}
4924
4909
4925
- $localResult = Set-AzResource @setAzResourceParameters - Confirm:$false - Force - ErrorAction Stop
4910
+ $localResult = Set-AzResource @setAzResourceParameters - UsePatchSemantics - Confirm:$false - Force - ErrorAction Stop
4926
4911
4927
4912
if ($PSBoundParameters.ContainsKey (' EnableWSSubscription' ) -and ($EnableWSSubscription -eq $false ))
4928
4913
{
0 commit comments