Publishing to Azure - HenrikWM/NNUG_GAB2016 GitHub Wiki

Publishing your projects to Azure

Publishing to Azure will require you to know what Azure Subcription, Resource Group and App Service Plan you want your app to be associated with and deployed to. You will be able to create a Resource Group and an App Service Plan by following the next steps in this guide.

If you do not have an Azure Subscription you can create one by visiting the Azure Account website.

Log in with your Microsoft Live ID

To start things off you might want to ensure that you're logged in with your Microsoft Live ID account in Visual Studio.

  1. Click on the link on the top right in Visual Studio. If you have been logged out (yellow warning icon) then log in again
  2. Choose a Work or School Account if you use an account that belongs in an AD. Most likely you want to click Personal account
  3. Click the log in button

You might also want to open the Cloud Explorer window (View > Cloud Explorer) and ensure that you are logged in there as well.

Publishing an app

This guide will show you how to publish an Azure API App (ASP.NET 4.5.2 Templates) but the process is the same for the other Azure app templates as well.

Begin by right-clicking on the project in the Solution Explorer and in the context menu click Publish.

In the Publish Web window click the Publish Target: Microsoft Azure App Service.

In the App Service window click the New button.

In the Create App Service window you will need to provide the API App Name, Subscription, Resource Group and your App Service Plan.

  • API App Name: enter a name following our GAB2016 naming convention. E.g.: nnug-gab2016-hwm-employeerecords-api
  • Subscription: Select the Azure subscription you want your app to be associated with
  • Resource Group: Select or create a new Resource Group. We recommend you create a new one for GAB2016 and name it according to our naming convention nnug-gab2016-<your initials>, e.g. nnug-gab2016-hwm. Select a Location close to you.
  • App Service Plan: Select or create a new App Service Plan for your app. We recommend you create a new one for GAB2016 and name it according to our naming convention just like in the Resource Group-step. In addition to selecting a Location, select the Free Size for your plan. When you're back at the Create App Service window, click on Create.

Visual Studio will now create a pubxml-file (Publish Profile) which are settings Web Deploy will use to deploy the app. It contains the details you have provided, including Web Deploy endpoints and generated credentials used for deployment of your app.

In the Publish Web window click the Validate Connection-button to ensure the credentials are OK. You should see a green check icon. Click on the Publish-button to publish the app to Azure.

Monitor the progress in Visual Studio by opening the docked Azure App Service Activity window.

A browser should open and navigate to your app's endpoint in Azure and contain a message similar to This web app has been successfully created. To disable this, open the pubxml-file inside of your project in Solution Explorer (Your Project > Properties > Publish Profiles) and set the values of LaunchSiteAfterPublish to False.

Open the Azure Portal and click on the App Services menu item in the left menu. You should see your app in the App Services list with Api App as the App Type, as well as the other expected properties you set when creating the app.

Congratulations! You have now successfully deployed an Api App to Azure!