Azure / Azure/azure-powershell

Issue with Update-AzWvdScalingPlan cmdlet - Required Fields Error

Open
#24,043 5 comments 0 reactions 1 assignee Claimed by @alec-baird View on GitHub
bug customer-reported DesktopVirtualization Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

I've encountered an issue while using the Update-AzWvdScalingPlan cmdlet in Azure PowerShell. Despite providing all required fields as per the official Microsoft documentation, I am receiving an error message indicating that certain required fields are missing. The cmdlt is run using powershell runtime 7.2 as part of an automations runbook.

Here is the error message I am receiving:

[400] : ActivityId: c13fd231-59fa-4f7d-9182-995c7dd6c927 Error: ≤{"errors":{"Schedules[0].PeakStartTime":["The PeakStartTime field is required."],"Schedules[0].RampUpStartTime":["The RampUpStartTime field is required."],"Schedules[0].OffPeakStartTime":["The OffPeakStartTime field is required."],"Schedules[0].RampDownStartTime":["The RampDownStartTime field is required."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-238698f4e672f5d31e9a35aa7739a93d-4a045c3e00f7d80f-01"}≥

The fields mentioned in the error message (PeakStartTime, RampUpStartTime, OffPeakStartTime, and RampDownStartTime) are all provided in my script, and I have ensured that they are in the correct format as specified in the Microsoft documentation.

Given that I am following the documentation closely and still encountering this error, I believe there may be an issue with either the Update-AzWvdScalingPlan cmdlet or the documentation itself.

### Issue script & Debug output

```PowerShell
Update-AzWvdScalingPlan `
-ResourceGroupName $resourceGroup `
-Name $name `
-Description $description `
-FriendlyName $friendlyName `
-TimeZone $timeZone `
-Schedule @(
@{
'Name' = $scalingPlanName
'DaysOfWeek' = @("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
'RampUpStartTime' = @{
'Hour' = 7
'Minute' = 0
}
'RampUpLoadBalancingAlgorithm' = "DepthFirst"
'RampUpMinimumHostsPct' = 100
'RampUpCapacityThresholdPct' = 100
'PeakStartTime' = @{
'Hour' = 8
'Minute' = 0
}
'PeakLoadBalancingAlgorithm' = "DepthFirst"
'PeakMinimumHostsPct' = 100
'RampDownStartTime' = @{
'Hour' = 20
'Minute' = 0
}
'RampDownLoadBalancingAlgorithm' = "DepthFirst"
'RampDownStopHostsWhen' = "ZeroSessions"
'RampDownNotificationSnoozeEnabled' = $false
'OffPeakStartTime' = @{
'Hour' = 18
'Minute' = 0
}
'OffPeakLoadBalancingAlgorithm' = "DepthFirst"
}
) `
-HostPoolReference @(
@{
'HostPoolArmPath' = "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.DesktopVirtualization/hostPools/$hostpoolName";
'ScalingPlanEnabled' = $false;
}
)
```

### Environment data

```PowerShell
automation runbook using powershell runtime 7.2 az module installed is 11.2 for runtime 7.2

Name Value
---- -----
PSVersion 7.2.0
PSEdition Core
GitCommitId 7.2.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.15.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContex…
Script 3.1.1 Az.DesktopVirtualization {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImag…
```

### Error output

```PowerShell
[400] : ActivityId: c13fd231-59fa-4f7d-9182-995c7dd6c927 Error: ≤{"errors":{"Schedules[0].PeakStartTime":["The PeakStartTime field is required."],"Schedules[0].RampUpStartTime":["The RampUpStartTime field is required."],"Schedules[0].OffPeakStartTime":["The OffPeakStartTime field is required."],"Schedules[0].RampDownStartTime":["The RampDownStartTime field is required."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-238698f4e672f5d31e9a35aa7739a93d-4a045c3e00f7d80f-01"}≥
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.