Picture reference – tv.ssw.com/tag/angular

Note – You can find the source code of my sample application here.

In my previous article, I have explained how to use .Net Core 2.0 Identity in your .Net Core 2.0 application, you can find the article here.

In this article, we will see how to create your Angular application using Visual Studio 2017(.Net Core 2.) and will deploy it to Azure.

prerequisite:

Visual studio 2017 community edition, download here

community edition, download here Azure account, you can create free trial account here

account, you can create free trial account here .Net Core 2.0 SDK from here (I have written a post to install SDK here)

Create the Angular application using .Net Core 2.0 template in VS 2017

Once you have all these installed, open your Visual Studio 2017 -> Create New Project -> Select Core Web application:

Click on Ok and in next window, select Angular as shown below:

Visual Studio will create a well-structured application for you:

I will not go deep into the Angular structure in this post but if you require more details then I have written a detailed post on Angular and .Net Core 2.0 which you find here.

Once you run the application on IISExpress, it will have the landing page as below:

Till now we have successfully created an Angular application using Visual Studio 2017 template and ran it on IISExpress.

Publish the Angular application on Azure

Right click on the solution and select Publish:

It will open the window in which you can publish your application on different hosts. Select Microsoft Azure App Service and click on Publish:

Once you click on Publish, it will try to sign you into your Azure account and Visual Studio will fetch the details (like your subscription, Resource Group etc) from your Azure account and will show it on the form. If you are not signed in automatically, you need to sign in manually.

Currently, it is trying to fetch the details from my Azure account:

Resource Group and App Service Plan:

Resource Group is a container in which Azure resources like web apps, databases, and storage accounts are deployed and managed.

App Service Plan is used to specify the size, location etc of your web farm which will host your application.

Click on New and add Resource Group and App Service Plan if you do not have it already.

If you want to add Database then click on Service tab and add\manage the databases:

If you do not wish to add the database then simply click on Create, it publishes the Angular web app to Azure and then launches the app into the default browser:

Note – If you observe the URL then you would understand that the web app name specified in the publish wizard is used as the URL prefix in the format.

for example – http://<app_name>.azurewebsites.net

You have successfully hosted your Angular application on Azure.

RePublish\ReDeploy the recent changes

Let us make some changes on the page and publish our changes to see if the changes are getting reflected in the Azure cloud or not:

I will change the home.component.html page and will modify the texts as below :

Save the changes and right click on the solution and click on Publish again.

Once the process is done, the browser will be launched:

As you can see, our changes are reflected in the Azure cloud.

Now whenever you want to push your recent changes, click on Publish and the Cloud will be updated.

You can manage your web application in the Azure under App services:

Note – You can find the source code of my sample application here.

Hope it helps.