Appsettings.json + Azure Web App + Docker

Product: PowerShell Universal
Version: 1.5.2

Hey Everyone,

I’m playing around with PU and Azure Web Service using Docker containers. I have 90% of it working with persistent storage using Azure FileShare Storage, but I can’t seem to get the appsettings.json file right.

I used the docs - https://docs.ironmansoftware.com/getting-started/docker#linux

to create my own custom docker image. should I be creating a new ENV path for the appsettings.json file? and where should I put this thing? I tried stuffing it in the Azure FileShare in multiple locations, but no luck.

Hi, i have performed this same task a while back and had no issues with the appsettings.json - if you are using Linux docker then it’s the appsettings.linux.json file you need to use. What i did was create the json file, then as part of docker deploy copy that file over to /home/Universal directory. This all worked - I am not on the laptop now that has the code but can look tomorrow. I did not have to create any special ENV variables. Linux Docker was super-fast and promising.

The issue i had with Azure Docker, which i will revisit soon is the auth. As i use OIDC auth to AAD for each user, this didn’t work as any combination of SSL and AAD Auth i tried doesn’t work, the webapp AAD auth doesn’t pass through to the dashboard, and OIDC won’t work as it requires HTTPS response which won’t work for the dashboard as the webapp uses HTTPS and the dashboard is on 5000(or 80 - couldn’t get 443 working as the webapp uses 443). Since then i now know i can edit the manifest of the AAD app to add/update https: to http: and it doesn’t complain so this may be straight forward to allow the webapp to look after SSL, and the PSU to request OIDC for AAD auth - i plan to revisit this in few weeks’ time.

Thanks @neo

I was looking to do something a bit different by having the appsettings.json file in the shared storage so i could just grab the latest PU docker image, and deploy it without having to pull down the appsettings.json file during docker create time.

In the docker file we have ENV variables… do we know if there is a variable I can create to point to a different location for the appsettings? Maybe a question for @adam ?

ENV Data__AppSettingsPath ./data/appsettings.json

And for the Auth

I had the same issue with OIDC back in the 2.X days. The only way I was able to get around it was to not use App Service, and use Container Instances with either K8 or NGINX as a load balancer infront of the UD container.

But I will take another crack at it later as well.

Sorry to bring up an older thread, wondering if you guys were able to figure out the Azure AD auth for App Services?

Found this article that might explain the issue with a solution, but might be out of our control.
Solved: .NET Core Azure AD in Docker Container Incorrectly Uses a non-https redirect URI - SeanKilleen.com

Looks like in the App Config you can add ASPNETCORE_FORWARDEDHEADERS_ENABLED = true and it will forward the headers or whatever correctly to the container.

image

Found this article that helped me.
Forwarded Headers Middleware Updates in .NET Core 3.0 preview 6 | ASP.NET Blog (microsoft.com)

1 Like