Home

Remove-RdsSessionhost : User is not authorized to query the management service.

%3CLINGO-SUB%20id%3D%22lingo-sub-719115%22%20slang%3D%22en-US%22%3ERemove-RdsSessionhost%20%3A%20User%20is%20not%20authorized%20to%20query%20the%20management%20service.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719115%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20half%20successful%20in%20deploying%20wvd%20so%20I%20want%20to%20delete%20my%20hostpool%20and%20start%20the%20deployment%20again.%20But%20I%20can't%20delete%20my%20hostpool%20cause%20I%20still%20have%20a%20sessionhost%20in%20it%20(the%20vm%20is%20not%20there%20anymore).%20When%20I%20try%20the%20powershell%20command%20Remove-RdsSessionHost%20with%20the%20force%20parameter%20I%20get%20the%20error%20from%20the%20subject.%20When%20I%20use%20the%20management%20website%20i%20get%20a%20general%20error%20message%20that%20I%20can't%20delete%20the%20host.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20used%20a%20Service%20Principal%20Name%20to%20deploy.%20I%20also%20created%20a%20new%20Service%20Principal%2C%20logged%20into%20the%20wvd%20environment%20but%20that%20gave%20the%20same%20error%20message.%20All%20accounts%20I%20tried%20it%20with%20are%20RDS%20Owner%20and%20RDS%20Contributor.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%20what%20else%20to%20do%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-719906%22%20slang%3D%22en-US%22%3ERE%3A%20Remove-RdsSessionhost%20%3A%20User%20is%20not%20authorized%20to%20query%20the%20management%20service.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-719906%22%20slang%3D%22en-US%22%3EI%20have%20made%20the%20Powershell%20below%2C%20to%20remove%20the%20objects%2C%20you've%20already%20created%20in%20a%20Sessionhost%20%3A%20%23%20Procedure%20to%20delete%20a%20HostPool%20and%20his%20content%20%24IMHostPoolName%20%3D%20%22HERE%20YOUR%20HOSTPOOL%22%20%24IMTenantName%20%3D%20%22HERE%20YOUR%20TENANTNAME%22%20%23%20%24IMdelhp%3DGet-RdsHostPool%20%24IMTenantName%20-HostPoolName%20%24IMHostPoolName%20%24IMdelShTt%20%3D%20Get-RdsSessionHost%20%24ImTenantName%20%24IMHostPoolName%20%24i%3D0%20ForEach%20(%24IMdelSh%20in%20%24IMdelShTt)%20%7B%20%24i%3D%24i%2B1%20Write-Host%20%22%20SessionHost%20%22%20%24i%20%22%20%3A%20%22%20%24IMdelSh.SessionHostName%20Remove-RdsSessionHost%20%24IMTenantName%20%24IMHostPoolName%20-Name%20%24IMdelSh.SessionHostName%20%7D%20%24IMdelAgTt%20%3D%20Get-RdsAppGroup%20%24IMTenantName%20%24IMHostPoolName%20%24j%3D0%20ForEach%20(%24IMdelAg%20in%20%24IMdelAgTt)%20%7B%20%24j%3D%24j%2B1%20%24IMdelUsTt%20%3D%20Get-RdsAppGroupUser%20%24IMTenantName%20%24IMHostPoolName%20-AppGroupName%20%24IMdelAg.AppGroupName%20ForEach%20(%24IMdelUs%20in%20%24IMdelUsTt)%20%7B%20Remove-RdsAppGroupUser%20%24IMTenantName%20%24IMHostPoolName%20-AppGroupName%20%24IMdelAg.AppGroupName%20-UserPrincipalName%20%24IMdelUs.UserPrincipalName%20%7D%20%24IMdelRaTt%20%3D%20Get-RdsRemoteApp%20%24IMTenantName%20%24IMHostPoolName%20%24IMdelAg.AppGroupName%20%24k%3D0%20ForEach%20(%24IMdelRa%20in%20%24IMdelRaTt)%20%7B%20%24k%3D%24k%2B1%20Remove-RdsRemoteApp%20%24IMTenantName%20%24IMHostPoolName%20-AppGroupName%20%24IMdelAg.AppGroupName%20-Name%20%24IMdelRa.FriendlyName%20%7D%20Remove-RdsAppGroup%20%24IMTenantName%20%24IMHostPoolName%20-Name%20%24IMdelAg.AppGroupName%20%7D%20Remove-RdsHostPool%20%24IMTenantName%20-HostPoolName%20%24IMHostPoolName%3C%2FLINGO-BODY%3E
Diederik Janson
Regular Visitor

Hi,

 

I was half successful in deploying wvd so I want to delete my hostpool and start the deployment again. But I can't delete my hostpool cause I still have a sessionhost in it (the vm is not there anymore). When I try the powershell command Remove-RdsSessionHost with the force parameter I get the error from the subject. When I use the management website i get a general error message that I can't delete the host.

 

I used a Service Principal Name to deploy. I also created a new Service Principal, logged into the wvd environment but that gave the same error message. All accounts I tried it with are RDS Owner and RDS Contributor.

 

Any ideas what else to do?

1 Reply
I have made the Powershell below, to remove the objects, you've already created in a Sessionhost : # Procedure to delete a HostPool and his content $IMHostPoolName = "HERE YOUR HOSTPOOL" $IMTenantName = "HERE YOUR TENANTNAME" # $IMdelhp=Get-RdsHostPool $IMTenantName -HostPoolName $IMHostPoolName $IMdelShTt = Get-RdsSessionHost $ImTenantName $IMHostPoolName $i=0 ForEach ($IMdelSh in $IMdelShTt) { $i=$i+1 Write-Host " SessionHost " $i " : " $IMdelSh.SessionHostName Remove-RdsSessionHost $IMTenantName $IMHostPoolName -Name $IMdelSh.SessionHostName } $IMdelAgTt = Get-RdsAppGroup $IMTenantName $IMHostPoolName $j=0 ForEach ($IMdelAg in $IMdelAgTt) { $j=$j+1 $IMdelUsTt = Get-RdsAppGroupUser $IMTenantName $IMHostPoolName -AppGroupName $IMdelAg.AppGroupName ForEach ($IMdelUs in $IMdelUsTt) { Remove-RdsAppGroupUser $IMTenantName $IMHostPoolName -AppGroupName $IMdelAg.AppGroupName -UserPrincipalName $IMdelUs.UserPrincipalName } $IMdelRaTt = Get-RdsRemoteApp $IMTenantName $IMHostPoolName $IMdelAg.AppGroupName $k=0 ForEach ($IMdelRa in $IMdelRaTt) { $k=$k+1 Remove-RdsRemoteApp $IMTenantName $IMHostPoolName -AppGroupName $IMdelAg.AppGroupName -Name $IMdelRa.FriendlyName } Remove-RdsAppGroup $IMTenantName $IMHostPoolName -Name $IMdelAg.AppGroupName } Remove-RdsHostPool $IMTenantName -HostPoolName $IMHostPoolName
Related Conversations
Extentions Synchronization
ChirmyRam in Discussions on
3 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies