Starting point here is a standard template from Microsoft for ASP.NET Core: I used Visual Studio => New Project => .NET Core
=> ASP.NET Core Web Application
I then ticked the box for HTTPS support and configured Work or School account
authentication against an existing Azure AD instance.
Then no matter whether I use http
or https
to run it locally, the redirect url during authentication always points to https - which is exactly as it should be.
When I deploy this into regular Azure App Service, it has the same behavior, which is fine.
BUT: If I create a docker image from this and deploy it to an Azure AppService with container support (linux-based in this case), then the authentication redirect always goes against http, which is really not what I want.
For reference, this is the Dockerfile used to build the image:
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY HttpsTest/HttpsTest.csproj HttpsTest/
RUN dotnet restore HttpsTest/HttpsTest.csproj
COPY . .
WORKDIR /src/HttpsTest
RUN dotnet build HttpsTest.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish HttpsTest.csproj -c Release -o /app
FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "HttpsTest.dll"]
Please note that I am not fiddling around with custom certificates inside the container, as I am using Azure App Service to terminate the SSL connection (and bring its own certificate with it along the way).
I am pretty sure there is something I am overlooking here.