Deploying to Azure App Service from Visual Studio for Mac
To deploy the eShopOnWeb sample application to an Azure App Service (assuming you’ve already cloned or downloaded it locally, and you have an Azure account), follow these steps from Visual Studio for Mac:
1. Open the eShopOnWeb solution in Visual Studio for Mac.
2. Right-click on the Web project in Solution Explorer and choose Publish - Publish to Azure…
3. Sign in if necessary, then choose an existing App Service or create a new one.
Click New
in this case.
4. Choose an App Name, Subscription, Resource Group, and App Service Plan, including region and pricing.
You can choose a free tier just to test things out. Click Next
.
5. Configure Docker Container.
If you want, you can deploy the app into a container. To do so, the container will be published to Azure’s container registry. Specify the registry details and then click Create. If you don’t want to deploy as a container, uncheck the box and then click Create.
6. Continue Working.
Creating the app service may take a few minutes. You’re free to continue working in the meantime.
Once the publish process has completed, your deployed app will launch in your browser.
Troubleshooting
You may see an error page like this one:
If so, you need to either use the Development
environment in your Azure App Service (which should only be done when testing), or configure an actual SQL Server database for the application to use.
To make this change, log in to the Azure Portal, navigate to your App Service, and go to its Configuration blade. Add a new configuration setting called ASPNETCORE_ENVIRONMENT
and give it a value of Development
.
Don’t forget to hit Save
, and then refresh your application. It should now load successfully:
Learn more about Azure deployment options in the official documentation.