>> Hi, there. I'm Steve Smith aka Ardalis.
In this short video, I'm going to show you how to
use Visual Studio for Mac to deploy
the eShopOnWeb reference application to Azure. Let's get started.
The first thing you need to do is go out to GitHub and download or
clone eShopOnWeb application and
then open it up in Visual Studio for Mac.
The next thing you'll need is a free Azure account,
which you can get from Azure.Microsoft.com
or use your existing Azure account if you prefer.
In Visual Studio for Mac,
all we need to do to deploy this application to Azure is
right-click on the web project
and then choose the published option.
Here, of course, we'll choose "Publish to Azure".
Now, we can choose an existing App Service to deploy to if we've
already deployed this app previously
or we can choose a new option.
Let's click on "New" to create a new App Service.
In the new App Service dialog,
we have to fill in a little bit of information,
starting with a unique App Service name.
I'm going to call this eShopOnWeb demo two.
Then we need to specify
a subscription as well as a resource group,
which in my case I'm going to match to
the name of the App Service so it's easy to find
later and likewise we need to specify a service plan,
which I'm going to do the same thing with so that
I can locate it later what I need to clean this up.
Let's pick a region a little bit closer to
home and let's pick a price plan, three sounds good.
When you're done click "Next".
Here we could configure a Docker container.
When you deploy a Docker container as an Azure App Service,
it uses a private registry that you create.
That's what this dialog is asking is how you'd like to
configure your private registry that will live
in Azure and maintain your containers that you push up into
Azure to use with
your App Services and other things that use containers in Azure.
We don't need to use a Docker container for this purpose,
so we're going to uncheck this box,
and then we're going to go ahead and create our new App Service.
Now, while it's creating the App Service,
we can continue to work on our project.
Visual Studio continues to be responsive.
We don't have to wait for this to
take place because it could take a little bit of time.
After a few minutes,
Visual Studio will launch a browser and load
our App so that we can verify that it was deployed correctly.
Now, Visual Studio has just launched
my browser to show me that the deployment has completed.
I expect there's going to be a problem though, and here it is.
We get an error page saying that we were loaded in the
wrong ASP.Net Core environment
and then if we switch to development mode,
we'll get more detailed information.
The issue here is that by default
it's going to be deployed in production mode,
and production mode expects a database.
So, we're going to go out to the Azure portal,
we're going to find our App Service,
we're going to click on its configuration settings,
we're going to add a new app setting ASP.Net Core_environment,
and we're going to set this value to development.
In development mode, our application
is going to use an in-memory database.
So, we'll be able to test it out even in Azure,
without having to create a separate database.
Don't forget to hit "Save" after
you make that change to the environment,
and then wait for it to let you know that is
completed updating the web settings.
Now, refresh the page,
and in just a few seconds,
we should see the application load successfully.
Now, remember this is only using an in-memory data store.
So, this is not something you want to use in production.
If we want to deploy the application
again in order to make additional updates,
the next time all we have to do is choose "Publish",
and then choose our previously configured publish plan.
After the second publish, the site loads once more,
and this time you can see everything works as expected.
This is a great way to share work in progress with
remote stakeholders while you're working on
a web application. That's it for this demo.
We deployed to Azure not once but twice.
I hope you enjoyed it,
and that you'll check out the eShopOnWeb reference application
available for free on GitHub.