skoruba / IdentityServer4.Admin

The administration for the IdentityServer4 and Asp.Net Core Identity
MIT License
3.56k stars 1.15k forks source link

Host IdentityServer4.Admin on Azure #108

Closed FrankDoersam closed 5 years ago

FrankDoersam commented 5 years ago

Hello,

the project looks really great. How should I do that the service is hosted in Azure?

Yours sincerely Frank

skoruba commented 5 years ago

Hi Frank, I will prepare the guide - how to create the “production” release. :) I will contact you.

Thanks!

FrankDoersam commented 5 years ago

Hello skoruba,

thank you for the fast feedback. I would really appreciate it if you could show how to fully publish the IdentityService in Azure. I wanted to use this for an Alexa skill :).

Yours sincerely Frank

skoruba commented 5 years ago

Please take a look at: https://github.com/skoruba/IdentityServer4.Admin/blob/master/docs/Configure-Azure-Deploy.md Thanks

tsangian commented 4 years ago

Hi Skoruba,

I have no problem running on local and then I tried to deploy to Azure App Service using Visual Studio Publish feature. Before deploying I followed the documentation, but then it shows "Internal Server Error: An error occurred while starting the application." when I tried to access the STS.Identity UI. Here's the exception from Log table in database (Azure SQL):

System.InvalidOperationException: IDX20803: Unable to obtain configuration from: '[PII is hidden]'. ---> System.IO.IOException: IDX20804: Unable to retrieve document from: '[PII is hidden]'. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleChallengeAsync(AuthenticationProperties properties) at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.ChallengeAsync(AuthenticationProperties properties) at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties) at Microsoft.AspNetCore.Mvc.ChallengeResult.ExecuteResultAsync(ActionContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAlwaysRunResultFilters() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Do you have any idea what causes the error?

The admin UI also returns HTTP 500 error. Only the API runs well since I can access the swagger UI.

Regards, Tim

tsangian commented 4 years ago

Found out the issue. I changed ASPNETCORE_ENVIRONMENT to Development (It was Production) and the error message shows up. Seems like the it can't find the certificate with the thumbprint provided from App Service TLS/SSL settings page. I'm still trying to figure out a solution for this.

Any help appreciated.

tsangian commented 4 years ago

Anyone having the same problem with me, you should add an app setting with name WEBSITE_LOAD_CERTIFICATES and value * to make your certificates accessible from the app.

Reference: https://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/

alvarovalle commented 4 years ago

Hi, I am having problems even after have been followed the step by step guide

here

image

here is my code

image

What do you suggest me to do?

thanks in advance