Forum Discussion
Unable to register new RDS Host via Powershell
I'm having trouble adding a custom Azure Image to an existing WVD Pool. I'm deploying the agents to a new RDS host via the following PowerShell commands (part of a larger script that builds the pool from scratch and adds the hosts):
Invoke-Command -Session $hostSessions -ScriptBlock {Start-Process -FilePath "msiexec.exe" -ArgumentList "/i C:\Support\RDInfraAgentInstall\RDAgent.msi", "/quiet", "/qn", "/norestart", "/passive", "REGISTRATIONTOKEN=$token", "/l* C:\Support\RDAgentInstall.txt" -Wait -Passthru}
Invoke-Command -Session $hostSessions -ScriptBlock {Start-Process -FilePath "msiexec.exe" -ArgumentList "/i C:\Support\RDAgentBootLoaderInstall\RDBootLoader.msi", "/quiet", "/qn", "/norestart", "/passive", "/l* C:\Support\RDBootLoaderInstall.txt" -Wait -Passthru}
Invoke-Command -Session $hostSessions -ScriptBlock {Start-Service RDAgentBootLoader}
Checking the install logs shows that both agents install fine. I can see all variables are correctly populated (including the registration token). However if I look at the WVD pool in the management console no RDS hosts are displayed. Rebooting the hosts doesn't help either. I can see a couple reoccurring errors in the event viewer but nothing particularly helpful:
BootLoader exception:System.AggregateException: One or more errors occurred. ---> System.Exception: Could not resolve a service of type 'Microsoft.RDInfra.ScheduledTasks.HostedServiceExecutor' for the parameter 'hostedServiceExecutor' of method 'Configure' on type 'Microsoft.RDInfra.RDAgent.Service.Startup'. ---> System.ArgumentException: IDX12741: JWT: '[PII is hidden]' must have three segments (JWS) or five segments (JWE).
at System.IdentityModel.Tokens.Jwt.JwtSecurityToken..ctor(String jwtEncodedString)
at Microsoft.RDInfra.RDAgent.Service.RDAgentBrokerConfiguration.GetDiagnosticsURI() in C:\agent\_work\14\s\src\RDAgent\src\Service\AgentSettings.cs:line 875
at Microsoft.RDInfra.Diagnostics.Agent.AgentRestPipelineSinkOptions.Configure(RestPipelineSinkOptions options) in C:\agent\_work\14\s\src\Shared\Diagnostics\src\Microsoft.RDInfra.Diagnostics.Agent\AgentRestPipelineSinkOptions.cs:line 32
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.RDInfra.Diagnostics.DataSink.RestPipelineSink..ctor(HttpClient httpClient, ILoggerFactory loggerFactory, IOptions`1 restPipelineSinkOptions, ITokenRetriever tokenRetriever, IMonitoringService monitoringService) in C:\agent\_work\14\s\src\Shared\Diagnostics\src\Microsoft.RDInfra.Diagnostics\DataSink\RestPipelineSink.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__4.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.RDInfra.RDAgent.Service.RDAgentMain.CreateRDAgentWebHost(String workingDirectory) in C:\agent\_work\14\s\src\RDAgent\src\Service\RDAgentMain.cs:line 69
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
at RDAgentBootLoader.RDAgentBootLoader.d__9.MoveNext() in C:\agent\_work\12\s\src\RDAgent\src\RDAgentBootLoader\RDAgentBootLoader.cs:line 61
---> (Inner Exception #0) System.Exception: Could not resolve a service of type 'Microsoft.RDInfra.ScheduledTasks.HostedServiceExecutor' for the parameter 'hostedServiceExecutor' of method 'Configure' on type 'Microsoft.RDInfra.RDAgent.Service.Startup'. ---> System.ArgumentException: IDX12741: JWT: '[PII is hidden]' must have three segments (JWS) or five segments (JWE).
at System.IdentityModel.Tokens.Jwt.JwtSecurityToken..ctor(String jwtEncodedString)
at Microsoft.RDInfra.RDAgent.Service.RDAgentBrokerConfiguration.GetDiagnosticsURI() in C:\agent\_work\14\s\src\RDAgent\src\Service\AgentSettings.cs:line 875
at Microsoft.RDInfra.Diagnostics.Agent.AgentRestPipelineSinkOptions.Configure(RestPipelineSinkOptions options) in C:\agent\_work\14\s\src\Shared\Diagnostics\src\Microsoft.RDInfra.Diagnostics.Agent\AgentRestPipelineSinkOptions.cs:line 32
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at Microsoft.RDInfra.Diagnostics.DataSink.RestPipelineSink..ctor(HttpClient httpClient, ILoggerFactory loggerFactory, IOptions`1 restPipelineSinkOptions, ITokenRetriever tokenRetriever, IMonitoringService monitoringService) in C:\agent\_work\14\s\src\Shared\Diagnostics\src\Microsoft.RDInfra.Diagnostics\DataSink\RestPipelineSink.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Hosting.Internal.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__4.MoveNext()<---No rollback agent provided!Resetting Agent to RDAgent_1.0.833.5
Even if I manually install the agents afterwards in an RDS host and reboot it still doesn't appear. However if I use Azure Portal to build the pool (with the same custom image) it works fine and builds a new pool with the hosts correctly added.
I can't see why installing the agents via Powershell is failing for my custom image. Anyone else come across this?
For anyone hitting this issue, please reach out to support through the Azure Portal, or follow guidance from our docs page: https://docs.microsoft.com/azure/virtual-desktop/troubleshoot-set-up-overview .
1 Reply
- Christian_Montoya
Microsoft
For anyone hitting this issue, please reach out to support through the Azure Portal, or follow guidance from our docs page: https://docs.microsoft.com/azure/virtual-desktop/troubleshoot-set-up-overview .