Skip to content

Commit 82463b1

Browse files
author
Zhongjie Li
committed
Resolve test issues
1 parent 1409711 commit 82463b1

File tree

96 files changed

+19143
-2410
lines changed

Some content is hidden

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

96 files changed

+19143
-2410
lines changed

src/DesktopVirtualization/DesktopVirtualization.Autorest/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,3 @@
2424
[assembly: System.Reflection.AssemblyVersionAttribute("5.4.2")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
2626
[assembly: System.CLSCompliantAttribute(false)]
27-
28-

src/DesktopVirtualization/DesktopVirtualization.Autorest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ In this directory, run AutoRest:
4444
> see https://aka.ms/autorest
4545
4646
``` yaml
47-
commit: 436fd672014049415ceb6aac6ef64a36a683bb6c
47+
commit: 53faa503c0f6155842e2487a087b7935b95914cc
4848
require:
4949
- $(this-folder)/../../readme.azure.noprofile.md
5050
sanitize-names: true

src/DesktopVirtualization/DesktopVirtualization.Autorest/docs/Update-AzWvdSessionHostManagement.md

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ Update a SessionHostManagement.
1515
### UpdateExpanded (Default)
1616
```
1717
Update-AzWvdSessionHostManagement -HostPoolName <String> -ResourceGroupName <String>
18-
[-SubscriptionId <String>] [-ScheduledDateTimeZone <String>] [-UpdateDeleteOriginalVM]
19-
[-UpdateLogOffDelayMinute <Int32>] [-UpdateLogOffMessage <String>] [-UpdateMaxVmsRemoved <Int32>]
20-
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
18+
[-SubscriptionId <String>] [-FailedSessionHostCleanupPolicy <String>] [-ProvisioningCanaryPolicy <String>]
19+
[-ProvisioningInstanceCount <Int32>] [-ProvisioningSetDrainMode] [-ScheduledDateTimeZone <String>]
20+
[-UpdateDeleteOriginalVM] [-UpdateLogOffDelayMinute <Int32>] [-UpdateLogOffMessage <String>]
21+
[-UpdateMaxVmsRemoved <Int32>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
2122
```
2223

2324
### UpdateViaIdentityExpanded
2425
```
2526
Update-AzWvdSessionHostManagement -InputObject <IDesktopVirtualizationIdentity>
26-
[-ScheduledDateTimeZone <String>] [-UpdateDeleteOriginalVM] [-UpdateLogOffDelayMinute <Int32>]
27-
[-UpdateLogOffMessage <String>] [-UpdateMaxVmsRemoved <Int32>] [-DefaultProfile <PSObject>] [-Confirm]
28-
[-WhatIf] [<CommonParameters>]
27+
[-FailedSessionHostCleanupPolicy <String>] [-ProvisioningCanaryPolicy <String>]
28+
[-ProvisioningInstanceCount <Int32>] [-ProvisioningSetDrainMode] [-ScheduledDateTimeZone <String>]
29+
[-UpdateDeleteOriginalVM] [-UpdateLogOffDelayMinute <Int32>] [-UpdateLogOffMessage <String>]
30+
[-UpdateMaxVmsRemoved <Int32>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
2931
```
3032

3133
### UpdateViaJsonFilePath
@@ -82,6 +84,21 @@ Accept pipeline input: False
8284
Accept wildcard characters: False
8385
```
8486
87+
### -FailedSessionHostCleanupPolicy
88+
The policy that should be applied when the Session Host provisioning operation fails.
89+
90+
```yaml
91+
Type: System.String
92+
Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded
93+
Aliases:
94+
95+
Required: False
96+
Position: Named
97+
Default value: None
98+
Accept pipeline input: False
99+
Accept wildcard characters: False
100+
```
101+
85102
### -HostPoolName
86103
The name of the host pool within the specified resource group
87104
@@ -142,6 +159,51 @@ Accept pipeline input: False
142159
Accept wildcard characters: False
143160
```
144161
162+
### -ProvisioningCanaryPolicy
163+
Policy on whether a Canary VM(a single VM to validate the configuration) should be provisioned during a session host provisioning operation.
164+
165+
```yaml
166+
Type: System.String
167+
Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded
168+
Aliases:
169+
170+
Required: False
171+
Position: Named
172+
Default value: None
173+
Accept pipeline input: False
174+
Accept wildcard characters: False
175+
```
176+
177+
### -ProvisioningInstanceCount
178+
The number of session hosts to exist in the Host Pool.
179+
180+
```yaml
181+
Type: System.Int32
182+
Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded
183+
Aliases:
184+
185+
Required: False
186+
Position: Named
187+
Default value: None
188+
Accept pipeline input: False
189+
Accept wildcard characters: False
190+
```
191+
192+
### -ProvisioningSetDrainMode
193+
Whether the session host should be set in drain mode following provisioning.
194+
195+
```yaml
196+
Type: System.Management.Automation.SwitchParameter
197+
Parameter Sets: UpdateExpanded, UpdateViaIdentityExpanded
198+
Aliases:
199+
200+
Required: False
201+
Position: Named
202+
Default value: None
203+
Accept pipeline input: False
204+
Accept wildcard characters: False
205+
```
206+
145207
### -ResourceGroupName
146208
The name of the resource group.
147209
The name is case insensitive.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"generate_Id": "5a3d6a43-b31c-4a0d-baf0-9c60c76a8d9a"
2+
"generate_Id": "f0eafa5d-3699-497d-a517-c8ca44ac1584"
33
}

src/DesktopVirtualization/DesktopVirtualization.Autorest/test/Disconnect-AzWvdUserSession.Recording.json

Lines changed: 127 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,155 @@
11
{
2-
"Disconnect-AzWvdUserSession+[NoContext]+Disconnect+$POST+https://management.azure.com/subscriptions/292d7caa-a878-4de8-b774-689097666272/resourceGroups/zhongjie-powershelltest/providers/Microsoft.DesktopVirtualization/hostPools/alecbUserSessionHP/sessionHosts/userSess-sh-0/userSessions/3/disconnect?api-version=2025-04-01-preview+1": {
2+
"Disconnect-AzWvdUserSession+[NoContext]+Disconnect+$GET+https://management.azure.com/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourceGroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostPools/zhongjie-automated/sessionHosts/auto-0/userSessions?api-version=2025-04-01-preview+1": {
3+
"Request": {
4+
"Method": "GET",
5+
"RequestUri": "https://management.azure.com/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourceGroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostPools/zhongjie-automated/sessionHosts/auto-0/userSessions?api-version=2025-04-01-preview",
6+
"Content": null,
7+
"isContentBase64": false,
8+
"Headers": {
9+
"x-ms-unique-id": [ "3" ],
10+
"x-ms-client-request-id": [ "609afa0a-b1af-4491-be2a-ec3adb420715" ],
11+
"CommandName": [ "Get-AzWvdUserSession" ],
12+
"FullCommandName": [ "Get-AzWvdUserSession_List" ],
13+
"ParameterSetName": [ "__AllParameterSets" ],
14+
"User-Agent": [ "AzurePowershell/v8.2.0", "PSVersion/v7.5.3", "Az.DesktopVirtualization/0.1.0" ],
15+
"Authorization": [ "[Filtered]" ]
16+
},
17+
"ContentHeaders": {
18+
}
19+
},
20+
"Response": {
21+
"StatusCode": 200,
22+
"Headers": {
23+
"Cache-Control": [ "no-cache" ],
24+
"Pragma": [ "no-cache" ],
25+
"Vary": [ "Accept-Encoding" ],
26+
"Set-Cookie": [ "ARRAffinity=ba8769d5d8f61043baf2042b0775d1ad6f711b9d9f4342819ff8fb726a0ac209;Path=/;HttpOnly;Secure;Domain=rdarmprovider-g-us-r0.wvd.microsoft.com", "ARRAffinitySameSite=ba8769d5d8f61043baf2042b0775d1ad6f711b9d9f4342819ff8fb726a0ac209;Path=/;HttpOnly;SameSite=None;Secure;Domain=rdarmprovider-g-us-r0.wvd.microsoft.com" ],
27+
"Server": [ "Microsoft-IIS/10.0" ],
28+
"x-ms-operation-identifier": [ "tenantId=715492f1-ef6e-4eea-9176-7c81e765c3c8,objectId=1db230a9-e046-46ab-912b-9cea769323a2/japaneast/2846376c-93b5-45e8-9025-651c596fd393" ],
29+
"X-Rate-Limit-Limit": [ "0" ],
30+
"X-Rate-Limit-Remaining": [ "9223372036854775807" ],
31+
"X-Rate-Limit-Reset": [ "0" ],
32+
"x-ms-opsarmpath64": [ "L3N1YnNjcmlwdGlvbnMvNjczODUwOWQtODRlZC00YWQ2LTk3NGEtN2RjNGUzYzM0MTQ2L3Jlc291cmNlR3JvdXBzL3pob25namllLXJnLXd1cy9wcm92aWRlcnMvTWljcm9zb2Z0LkRlc2t0b3BWaXJ0dWFsaXphdGlvbi9ob3N0UG9vbHMvemhvbmdqaWUtYXV0b21hdGVkL3Nlc3Npb25Ib3N0cy9hdXRvLTA=" ],
33+
"x-ms-lamport-ts": [ "10114328638" ],
34+
"x-ms-correlation-id": [ "a602b0d8-5fe5-4332-ad1c-0dd550fff930" ],
35+
"x-ms-request-id": [ "609afa0a-b1af-4491-be2a-ec3adb420715" ],
36+
"X-Powered-By": [ "ASP.NET" ],
37+
"X-Content-Type-Options": [ "nosniff" ],
38+
"x-ms-ratelimit-remaining-subscription-reads": [ "249" ],
39+
"x-ms-ratelimit-remaining-subscription-global-reads": [ "3749" ],
40+
"x-ms-correlation-request-id": [ "4c4213b3-a631-4b0b-9ca5-166af3ab3065" ],
41+
"x-ms-routing-request-id": [ "JAPANEAST:20251029T022050Z:4c4213b3-a631-4b0b-9ca5-166af3ab3065" ],
42+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
43+
"Date": [ "Wed, 29 Oct 2025 02:20:49 GMT" ]
44+
},
45+
"ContentHeaders": {
46+
"Content-Length": [ "734" ],
47+
"Content-Type": [ "application/json; charset=utf-8" ],
48+
"Expires": [ "-1" ]
49+
},
50+
"Content": "{\"value\":[{\"name\":\"zhongjie-automated/auto-0/2\",\"id\":\"/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourcegroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostpools/zhongjie-automated/sessionhosts/auto-0/usersessions/2\",\"type\":\"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions\",\"properties\":{\"createTime\":\"2025-10-28T02:44:32.89Z\",\"userPrincipalName\":null,\"sessionState\":\"Disconnected\",\"applicationType\":\"Desktop\",\"activeDirectoryUserName\":\"auto-0\\\\zhongjieli\",\"objectId\":\"50f3b20f-4a1e-49c9-a61a-5143bf52c28b\"},\"systemData\":{\"createdBy\":null,\"createdByType\":null,\"createdAt\":\"2025-10-28T02:44:32.89Z\",\"lastModifiedBy\":null,\"lastModifiedByType\":null,\"lastModifiedAt\":null}}],\"nextLink\":null}",
51+
"isContentBase64": false
52+
}
53+
},
54+
"Disconnect-AzWvdUserSession+[NoContext]+Disconnect+$POST+https://management.azure.com/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourceGroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostPools/zhongjie-automated/sessionHosts/auto-0/userSessions/2/disconnect?api-version=2025-04-01-preview+2": {
355
"Request": {
456
"Method": "POST",
5-
"RequestUri": "https://management.azure.com/subscriptions/292d7caa-a878-4de8-b774-689097666272/resourceGroups/zhongjie-powershelltest/providers/Microsoft.DesktopVirtualization/hostPools/alecbUserSessionHP/sessionHosts/userSess-sh-0/userSessions/3/disconnect?api-version=2025-04-01-preview",
57+
"RequestUri": "https://management.azure.com/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourceGroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostPools/zhongjie-automated/sessionHosts/auto-0/userSessions/2/disconnect?api-version=2025-04-01-preview",
658
"Content": null,
759
"isContentBase64": false,
860
"Headers": {
9-
"x-ms-unique-id": [ "2" ],
10-
"x-ms-client-request-id": [ "6120bd1f-e0fb-4d2f-aed5-8abb1075f799" ],
61+
"x-ms-unique-id": [ "4" ],
62+
"x-ms-client-request-id": [ "76899d43-6fa2-4fe9-80c8-e48a08593b67" ],
1163
"CommandName": [ "Disconnect-AzWvdUserSession" ],
1264
"FullCommandName": [ "Disconnect-AzWvdUserSession_Disconnect" ],
1365
"ParameterSetName": [ "__AllParameterSets" ],
14-
"User-Agent": [ "AzurePowershell/v8.2.0", "PSVersion/v7.5.3", "Az.DesktopVirtualization/5.4.2" ],
66+
"User-Agent": [ "AzurePowershell/v8.2.0", "PSVersion/v7.5.3", "Az.DesktopVirtualization/0.1.0" ],
1567
"Authorization": [ "[Filtered]" ]
1668
},
1769
"ContentHeaders": {
1870
}
1971
},
2072
"Response": {
21-
"StatusCode": 404,
73+
"StatusCode": 200,
2274
"Headers": {
2375
"Cache-Control": [ "no-cache" ],
2476
"Pragma": [ "no-cache" ],
25-
"x-ms-failure-cause": [ "gateway" ],
26-
"x-ms-request-id": [ "afe88668-37bd-4f8d-bda0-3e540a9f8d6d" ],
27-
"x-ms-correlation-request-id": [ "afe88668-37bd-4f8d-bda0-3e540a9f8d6d" ],
28-
"x-ms-routing-request-id": [ "SOUTHEASTASIA:20251013T071615Z:afe88668-37bd-4f8d-bda0-3e540a9f8d6d" ],
77+
"Set-Cookie": [ "ARRAffinity=9fa6c0b82e1d7da4a533be6bd9bc598a7378a1d1d9fd035b439a7dee1d6cddf7;Path=/;HttpOnly;Secure;Domain=rdarmprovider-g-us-r0.wvd.microsoft.com", "ARRAffinitySameSite=9fa6c0b82e1d7da4a533be6bd9bc598a7378a1d1d9fd035b439a7dee1d6cddf7;Path=/;HttpOnly;SameSite=None;Secure;Domain=rdarmprovider-g-us-r0.wvd.microsoft.com" ],
78+
"Server": [ "Microsoft-IIS/10.0" ],
79+
"X-Rate-Limit-Limit": [ "0" ],
80+
"X-Rate-Limit-Remaining": [ "9223372036854775807" ],
81+
"X-Rate-Limit-Reset": [ "0" ],
82+
"x-ms-opsarmpath64": [ "L3N1YnNjcmlwdGlvbnMvNjczODUwOWQtODRlZC00YWQ2LTk3NGEtN2RjNGUzYzM0MTQ2L3Jlc291cmNlR3JvdXBzL3pob25namllLXJnLXd1cy9wcm92aWRlcnMvTWljcm9zb2Z0LkRlc2t0b3BWaXJ0dWFsaXphdGlvbi9ob3N0UG9vbHMvemhvbmdqaWUtYXV0b21hdGVkL3Nlc3Npb25Ib3N0cy9hdXRvLTAvdXNlclNlc3Npb25zLzI=" ],
83+
"x-ms-lamport-ts": [ "10114328994" ],
84+
"x-ms-correlation-id": [ "04b66ec0-bd21-4bf5-bbff-1b8c32166e45" ],
85+
"x-ms-request-id": [ "76899d43-6fa2-4fe9-80c8-e48a08593b67" ],
86+
"X-Powered-By": [ "ASP.NET" ],
87+
"X-Content-Type-Options": [ "nosniff" ],
88+
"x-ms-operation-identifier": [ "tenantId=715492f1-ef6e-4eea-9176-7c81e765c3c8,objectId=1db230a9-e046-46ab-912b-9cea769323a2/japaneast/0f617bb1-c337-4dba-9d0a-2cef0430fbf8" ],
89+
"x-ms-ratelimit-remaining-subscription-writes": [ "199" ],
90+
"x-ms-ratelimit-remaining-subscription-global-writes": [ "2999" ],
91+
"x-ms-correlation-request-id": [ "33faecf0-6f50-444b-a1bf-4b9fcf2760a9" ],
92+
"x-ms-routing-request-id": [ "JAPANEAST:20251029T022051Z:33faecf0-6f50-444b-a1bf-4b9fcf2760a9" ],
2993
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
94+
"Date": [ "Wed, 29 Oct 2025 02:20:51 GMT" ]
95+
},
96+
"ContentHeaders": {
97+
"Expires": [ "-1" ],
98+
"Content-Length": [ "0" ]
99+
},
100+
"Content": null,
101+
"isContentBase64": false
102+
}
103+
},
104+
"Disconnect-AzWvdUserSession+[NoContext]+Disconnect+$GET+https://management.azure.com/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourceGroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostPools/zhongjie-automated/sessionHosts/auto-0/userSessions/2?api-version=2025-04-01-preview+3": {
105+
"Request": {
106+
"Method": "GET",
107+
"RequestUri": "https://management.azure.com/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourceGroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostPools/zhongjie-automated/sessionHosts/auto-0/userSessions/2?api-version=2025-04-01-preview",
108+
"Content": null,
109+
"isContentBase64": false,
110+
"Headers": {
111+
"x-ms-unique-id": [ "5" ],
112+
"x-ms-client-request-id": [ "7877261f-1d38-4ddc-898c-dadff70640a4" ],
113+
"CommandName": [ "Get-AzWvdUserSession" ],
114+
"FullCommandName": [ "Get-AzWvdUserSession_Get" ],
115+
"ParameterSetName": [ "__AllParameterSets" ],
116+
"User-Agent": [ "AzurePowershell/v8.2.0", "PSVersion/v7.5.3", "Az.DesktopVirtualization/0.1.0" ],
117+
"Authorization": [ "[Filtered]" ]
118+
},
119+
"ContentHeaders": {
120+
}
121+
},
122+
"Response": {
123+
"StatusCode": 200,
124+
"Headers": {
125+
"Cache-Control": [ "no-cache" ],
126+
"Pragma": [ "no-cache" ],
127+
"Vary": [ "Accept-Encoding" ],
128+
"Set-Cookie": [ "ARRAffinity=fa5ce4b13622b0d3617b4398e823c470b20f49c8905d33671c1e72b454b4c01b;Path=/;HttpOnly;Secure;Domain=rdarmprovider-g-us-r0.wvd.microsoft.com", "ARRAffinitySameSite=fa5ce4b13622b0d3617b4398e823c470b20f49c8905d33671c1e72b454b4c01b;Path=/;HttpOnly;SameSite=None;Secure;Domain=rdarmprovider-g-us-r0.wvd.microsoft.com" ],
129+
"Server": [ "Microsoft-IIS/10.0" ],
130+
"x-ms-operation-identifier": [ "tenantId=715492f1-ef6e-4eea-9176-7c81e765c3c8,objectId=1db230a9-e046-46ab-912b-9cea769323a2/japaneast/922dd6f3-11b4-4649-a0a2-d62ab636f939" ],
131+
"X-Rate-Limit-Limit": [ "0" ],
132+
"X-Rate-Limit-Remaining": [ "9223372036854775807" ],
133+
"X-Rate-Limit-Reset": [ "0" ],
134+
"x-ms-opsarmpath64": [ "L3N1YnNjcmlwdGlvbnMvNjczODUwOWQtODRlZC00YWQ2LTk3NGEtN2RjNGUzYzM0MTQ2L3Jlc291cmNlR3JvdXBzL3pob25namllLXJnLXd1cy9wcm92aWRlcnMvTWljcm9zb2Z0LkRlc2t0b3BWaXJ0dWFsaXphdGlvbi9ob3N0UG9vbHMvemhvbmdqaWUtYXV0b21hdGVkL3Nlc3Npb25Ib3N0cy9hdXRvLTAvdXNlclNlc3Npb25zLzI=" ],
135+
"x-ms-lamport-ts": [ "10114329722" ],
136+
"x-ms-correlation-id": [ "c7fde66e-e12f-45bc-bc4a-4e1df4102616" ],
137+
"x-ms-request-id": [ "7877261f-1d38-4ddc-898c-dadff70640a4" ],
138+
"X-Powered-By": [ "ASP.NET" ],
30139
"X-Content-Type-Options": [ "nosniff" ],
31-
"X-Cache": [ "CONFIG_NOCACHE" ],
32-
"X-MSEdge-Ref": [ "Ref A: 3174098A46D742E09DBCB674C133CF96 Ref B: JKT201051406052 Ref C: 2025-10-13T07:16:14Z" ],
33-
"Date": [ "Mon, 13 Oct 2025 07:16:14 GMT" ]
140+
"x-ms-ratelimit-remaining-subscription-reads": [ "248" ],
141+
"x-ms-ratelimit-remaining-subscription-global-reads": [ "3748" ],
142+
"x-ms-correlation-request-id": [ "393e838f-7fa1-4750-8512-19ff50295bfe" ],
143+
"x-ms-routing-request-id": [ "JAPANEAST:20251029T022052Z:393e838f-7fa1-4750-8512-19ff50295bfe" ],
144+
"Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ],
145+
"Date": [ "Wed, 29 Oct 2025 02:20:51 GMT" ]
34146
},
35147
"ContentHeaders": {
36-
"Content-Length": [ "383" ],
148+
"Content-Length": [ "706" ],
37149
"Content-Type": [ "application/json; charset=utf-8" ],
38150
"Expires": [ "-1" ]
39151
},
40-
"Content": "{\"error\":{\"code\":\"ParentResourceNotFound\",\"message\":\"Failed to perform \u0027action\u0027 on resource(s) of type \u0027hostpools/sessionhosts/usersessions\u0027, because the parent resource \u0027/subscriptions/292d7caa-a878-4de8-b774-689097666272/resourceGroups/zhongjie-powershelltest/providers/Microsoft.DesktopVirtualization/hostpools/alecbUserSessionHP/sessionhosts/userSess-sh-0\u0027 could not be found.\"}}",
152+
"Content": "{\"name\":\"zhongjie-automated/auto-0/2\",\"id\":\"/subscriptions/6738509d-84ed-4ad6-974a-7dc4e3c34146/resourcegroups/zhongjie-rg-wus/providers/Microsoft.DesktopVirtualization/hostpools/zhongjie-automated/sessionhosts/auto-0/usersessions/2\",\"type\":\"Microsoft.DesktopVirtualization/hostpools/sessionhosts/usersessions\",\"properties\":{\"createTime\":\"2025-10-28T02:44:32.89Z\",\"userPrincipalName\":null,\"sessionState\":\"Disconnected\",\"applicationType\":\"Desktop\",\"activeDirectoryUserName\":\"auto-0\\\\zhongjieli\",\"objectId\":\"50f3b20f-4a1e-49c9-a61a-5143bf52c28b\"},\"systemData\":{\"createdBy\":null,\"createdByType\":null,\"createdAt\":\"2025-10-28T02:44:32.89Z\",\"lastModifiedBy\":null,\"lastModifiedByType\":null,\"lastModifiedAt\":null}}",
41153
"isContentBase64": false
42154
}
43155
}

src/DesktopVirtualization/DesktopVirtualization.Autorest/test/Disconnect-AzWvdUserSession.Tests.ps1

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,37 @@ if (-Not (Test-Path -Path $loadEnvPath)) {
55
. ($loadEnvPath)
66
$TestRecordingFile = Join-Path $PSScriptRoot 'Disconnect-AzWvdUserSession.Recording.json'
77
$currentPath = $PSScriptRoot
8-
$userName = $env.HostPoolPersistent + '/' + $env.SessionHostName + '/3'
98
while(-not $mockingPath) {
109
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
1110
$currentPath = Split-Path -Path $currentPath -Parent
1211
}
1312
. ($mockingPath | Select-Object -First 1).FullName
1413

1514
Describe 'Disconnect-AzWvdUserSession' {
15+
1616
It 'Disconnect' {
17+
# User session will not be found when the session host hasn't been connected with.
18+
$userSessions = Get-AzWvdUserSession -SubscriptionId $env.SubscriptionId `
19+
-ResourceGroupName $env.ResourceGroupPersistent `
20+
-HostPoolName $env.HostPoolPersistent `
21+
-SessionHostName $env.SessionHostName
22+
23+
$userSessionToDisconnectParts = $userSessions[0].Id -split '/'
24+
25+
$userSessionIdToDisconnect = $userSessionToDisconnectParts[-1]
26+
1727
Disconnect-AzWvdUserSession -SubscriptionId $env.SubscriptionId `
1828
-ResourceGroupName $env.ResourceGroupPersistent `
1929
-HostPoolName $env.HostPoolPersistent `
2030
-SessionHostName $env.SessionHostName `
21-
-Id 3
22-
31+
-Id $userSessionIdToDisconnect
32+
2333
$userSession = Get-AzWvdUserSession -SubscriptionId $env.SubscriptionId `
2434
-ResourceGroupName $env.ResourceGroupPersistent `
2535
-HostPoolName $env.HostPoolPersistent `
2636
-SessionHostName $env.SessionHostName `
27-
-Id 3
28-
$userSession.Name | Should -Be $userName
29-
$userSession.SessionState | Should -Be 'Disconnected'
37+
-Id $userSessionIdToDisconnect
38+
$userSession.Name | Should -Be $userSessions[0].Name
39+
$userSession.SessionState | Should -Be 'Disconnected'
3040
}
3141
}

0 commit comments

Comments
 (0)