jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core
MIT License
16.92k stars 3.64k forks source link

Clean Architecture Deployment in Azure #169

Closed ralpholazo24 closed 4 years ago

ralpholazo24 commented 4 years ago

Is there any tutorial on how to deploy this on microsoft azure?

GFoley83 commented 4 years ago

There's are no special considerations when deploying the solution to Azure; it's a standard .NET Core solution.

Similar question was already asked and answered here: https://github.com/jasontaylordev/CleanArchitecture/issues/80#issuecomment-605941356

workcontrolgit commented 4 years ago

I did experiment with the deployment with the backend is MS SQL SaS to Azure from Visual Studio 2019 Community. Here are the steps

  1. Create app service and download the publishing profile
  2. Setup connection string in the app service to point to MSSQL SaS DB
  3. In VS Studio, publish the app to Azure using the publishing profile (in step 1)

Issues I ran into

  1. Identify server certificate error (HTTP error 500.30 error code) - since it is for experimentation, I changed the IdentityServer setting in the production appsettings.json the same as the development (not require cert)
  2. SQL Server firewall error (also shown as HTTP error 500.30) - updated the MS SQL server firewall/IP restriction to allow App Service to access the database server.

Disclaimer - The above instructions are for development proof of concept only.

ralpholazo24 commented 4 years ago

For my updates, I can now deploy the app on Azure VM using IIS but I am experience error if I am trying to log in.

I have an error when calling the connect/token api.

Here are my parameters.

image image

workcontrolgit commented 4 years ago

The form data looks right. 400 error is tricky as it could be on the client and server. Maybe clear cookie and also check the IIS server log.

GFoley83 commented 4 years ago

Have you configured IdentityServer correctly for the environment? https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-3.1#deploy-to-production

You might have more luck on StackOverflow, which is the best forum for questions like this.

akqira commented 4 years ago

Hi @ralpholazo24 To share my experience, i've got the same issue on Azure and not locally. After some investigations i found that my Current Plan for the App Service (shared free instance) does not allow me to read my certificate file in order to sign the token. This is a limitation by Microsoft, one of the solutions is to upgrade to basic plan

https://github.com/dotnet/runtime/issues/30658#issuecomment-523987878

Regards

jasontaylordev commented 4 years ago

Closing (as covered in #80), but I promise to write a guide soon. ❤