Unable to start dashboard with Powershell 7 in Azure

When i try to start my dashboard i get the error at the end of this post. Powershell Universal is working, and the web.config is based on this manual GitHub - ironmansoftware/universal-azure-actions: GitHub actions for deploying PowerShell Universal to Azure.. I have changed the PSModulePath environment configuration with the following entry, if that was not configured, Universal.psd1 could not be found by the dashboard:

<environmentVariable name="PSModulePath" value="WindowsPowerShell\Modules;D:\Program Files\WindowsPowerShell\Modules;D:\Windows\system32\WindowsPowerShell\v1.0\Modules;D:\Program Files\WindowsPowerShell\Modules\;D:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\;D:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\Storage\;D:\Program Files\Microsoft Message Analyzer\PowerShell\;D:\home\site\wwwroot\" />

I have published powershell 7 alongside universal dashboard. We want to use PS7, but it is not available in an azure app service. When i use the default powershell 5, it works fine. I cannot find why pwsh.exe is not working. Is there more logging available? Has anyone else got this to work?

The error:

dbug: UniversalAutomation.JobProcessManager[0]

      Starting posh\pwsh.exe with command line  -NoProfile -Command "& { [System.Reflection.Assembly]::LoadFrom('D:\home\site\wwwroot\Host.dll') | Out-Null; [UniversalHost.AgentService]::StartDashboard(53875, 12584) }"

info: UniversalAutomation.JobProcessManager[0]

      Starting job using Process.
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]

      An unhandled exception has occurred while executing the request.

System.Exception: Failed to start dashboard.

   at Universal.Server.Services.DashboardProxy.Start(Dashboard dashboard) in D:\a\universal\universal\src\Universal.Server\Services\DashboardProxy.cs:line 123

   at Universal.Server.Services.DashboardManager.Start(Dashboard dashboard) in D:\a\universal\universal\src\Universal.Server\Services\DashboardManager.cs:line 81

   at UniversalAutomation.DashboardController.Start(Int64 id) in D:\a\universal\universal\src\Universal.Server\Controllers\DashboardController.cs:line 166

   at lambda_method(Closure , Object , Object[] )

   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)

   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)

   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)

   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in D:\a\universal\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 113

   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)

   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)

   at AspNetCoreRateLimit.RateLimitMiddleware`1.Invoke(HttpContext context) in D:\a\universal\universal\src\AspNetCoreRateLimit\Middleware\RateLimitMiddleware.cs:line 109

   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Product: PowerShell Universal
Version: 1.5.15

My guess is that it is failing to find the pwsh.exe. Can you try the full path as a debugging step? I think you can find that out by open the advanced tools for your web app and use the terminal provided.

Same error

dbug: UniversalAutomation.JobProcessManager[0]

      Starting D:\home\site\wwwroot\posh\pwsh.exe with command line  -NoProfile -Command "& { [System.Reflection.Assembly]::LoadFrom('D:\home\site\wwwroot\Host.dll') | Out-Null; [UniversalHost.AgentService]::StartDashboard(57223, 15208) }"

info: UniversalAutomation.JobProcessManager[0]

      Starting job using Process.

fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]

      An unhandled exception has occurred while executing the request.

System.Exception: Failed to start dashboard.

   at Universal.Server.Services.DashboardProxy.Start(Dashboard dashboard) in D:\a\universal\universal\src\Universal.Server\Services\DashboardProxy.cs:line 123

   at Universal.Server.Services.DashboardManager.Start(Dashboard dashboard) in D:\a\universal\universal\src\Universal.Server\Services\DashboardManager.cs:line 81

   at UniversalAutomation.DashboardController.Start(Int64 id) in D:\a\universal\universal\src\Universal.Server\Controllers\DashboardController.cs:line 166

   at lambda_method(Closure , Object , Object[] )

   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvo

This the error reported in the eventlog.xml

<Event>
    <System>
        <Provider Name=".NET Runtime"/>
        <EventID>1000</EventID>
        <Level>1</Level>
        <Task>0</Task>
        <Keywords>Keywords</Keywords>
        <TimeCreated SystemTime="2021-04-19T07:00:28Z"/>
        <EventRecordID>637915875</EventRecordID>
        <Channel>Application</Channel>
        <Computer>[snip]</Computer>
        <Security/>
    </System>
    <EventData>
        <Data>Category: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
EventId: 1
RequestId: 80000a2b-0000-7700-b63f-84710c7967bb
RequestPath: /api/v1/dashboard/1/status
SpanId: 81a99459f3da2d42
TraceId: a91a2eb8490cbb4abaa9d309addb4984
ParentId: 0000000000000000

An unhandled exception has occurred while executing the request.

Exception: 
System.Exception: Failed to start dashboard.
   at Universal.Server.Services.DashboardProxy.Start(Dashboard dashboard) in D:\a\universal\universal\src\Universal.Server\Services\DashboardProxy.cs:line 123
   at Universal.Server.Services.DashboardManager.Start(Dashboard dashboard) in D:\a\universal\universal\src\Universal.Server\Services\DashboardManager.cs:line 81
   at UniversalAutomation.DashboardController.Start(Int64 id) in D:\a\universal\universal\src\Universal.Server\Controllers\DashboardController.cs:line 166
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.&lt;Invoke&gt;g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Universal.Server.Middleware.RoutingMiddleware.Invoke(HttpContext httpContext, IPolicyEvaluator policyEvaluator) in D:\a\universal\universal\src\Universal.Server\Middleware\RoutingMiddleware.cs:line 113
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at AspNetCoreRateLimit.RateLimitMiddleware`1.Invoke(HttpContext context) in D:\a\universal\universal\src\AspNetCoreRateLimit\Middleware\RateLimitMiddleware.cs:line 109
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.&lt;Invoke&gt;g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
</Data>
    </EventData>
</Event>