How to Provision an Environment in Azure

It’s been a while since I’ve posted so I do apologize for the lag.  I’ve been doing some experimenting with Azure in my RL job and I’d like to share a couple of lessons learned with provisioning and deploying to Azure.

I was looking for an outline on simple deployments and found a quick walk-through at Useful Development Blog. Using this outline, I’m going to provision an environment and deploy a simple web app to Azure.

The prerequisites noted in the article are as follows:

* Visual Studio 2013 (Update 3+)
* The Azure SDK (you can get that here or use the Web Platform Installer)
* an account with Azure

I’m going to use the tools deployed previously to accomplish the same tasks. The only difference should be that I’m using Visual Studio 2015 Community rather than 2013.  Also, i’m going to provision my environment FIRST prior to deployment.  While you can automatically let Visual Studio create the necessary Azure nodes automatically in order to host your app, I feel that it will be necessary to know exactly what I’m provisioning and how much it will cost.

After reviewing the article, it looks like I’ll need a Web App node as well as a SQL database for the backend. In order to put all of this together, I’ll want to create the following resources:

* Azure Resource Group – This is a logical grouping of managed resources. It makes it easier to organize your nodes and identify which are related and dependent on each other. Also, in the event of any relevant notifications from Microsoft about impacts or changes to a region, you’ll want to know which one your resources are in.
* Azure Storage Group – This is a shared storage pool that can be used by any of your Azure nodes that require it.
* Azure Virtual Network – This isn’t truly required since we won’t be doing any network design or provisioning, but some of the nodes will require that one be set.
* SQL DB + DB Server – These will be PaaS (Platform as a Service) nodes to host my database.
* Web App – This will be another PaaS node to host the actual app.

I’ll begin by logging into the Azure portal and creating the Resource Group. You do this from your portal dashboard and clicking Resources Groups in the left sidebar then Add.  Choose an appropriate name, which subscription you want it to belong to, and where you want the Resource Group to be located.  The location may be relevant depending on where your customer base is for purposes of latency, etc.

RGCreation

Once the resource group is created, I’ll want to create a Storage Group. It can be more economical to use a shared storage group rather than many individual storage groups for each node. Additionally, you have more options for selecting the redundancy/fault tolerance of the storage as well as options for speed, etc.

To create the storage group, navigate to the Resource Group and click Add. A search window will pop-up where you can search for any of the myriad of nodes available in the Azure catalog. Select Storage Account and when prompted select Resource Manager for your deployment model and click Create.

CreateFromRG

StorageCreate

You’ll be prompted for the parameters to be used for your storage account. I will pick Locally Redundant and disable Diagnostics. Also, I’ll be selecting the Resource Group created in previous steps. When selecting your storage parameters, the amount listed for pricing is per month/100GB. You should only be charged for what you actually use so the cost should be pro-rated for the month.

StorageAccountParams

Next, I’ll create the Virtual Network. Follow the previous steps of navigating to your Resource Group and clicking Add. This time, type Network for your search criteria and select Virtual Network. As before, select the Resource Manager option and click Create.

For my parameters, I’ll be choosing an appropriate name and selecting my existing Resource Group and Location. Once this is selected, click Create.

NetworkParams

The next step, creating the SQL Server and DB, will be a bit more complicated but will follow the same basic pattern. As before, go to your Resource Group and click Add, then use SQL as your search criteria. The type of node you’ll select to create will be SQL Database. Once you’ve selected that option, click Create.

SQL DB Create

Inside of the SQL Database create panel, you’ll have an option to select your Server. Since we don’t have a server yet, our first step will be to create one. Click in the Server panel and then select Create a New Server. When creating a new server, you’ll choose an appropriate SQL Server name as well as creating your SA Account and password.  You’ll also select a location for the node.

SQL DB Params

SQL Server Params

Now that we have our Server, we can finish creating our DB. You can select an existing DB backup to map from or even use the sample Northwinds database. I’ll be selecting Blank DB for this example. There are a large number of pricing options to choose from for your DB performance and sizing options. Select the one that’s most appropriate for your app. Your subscription and Resource Group options should auto-populate. Once you’ve selected your options, click Create. The SQL DB creation takes a few minutes.

SQL DB Params 2

Lastly, we’ll need to provision a Web App node to host the actual app. Again, from your Resource Group, click Add and use Web App for your search criteria. Select the Web App option and click Create.

Web App Create

Once inside the creation dialog, you’ll choose an appropriate name for your app as well as confirm that your subscription info and Resource Group is correct. The last thing you’ll do is select a Service Plan. This is a configuration that can help you standardize your pricing and performance expectations for multiple apps. If you’re doing large scale or automated deployments, these can be useful to have for future tasks.

Under App Service Plan, click Create New.  Inside of the App Service plan creation panel, choose an appropriate name for the plan.  Under pricing options, you have various levels of availability and performance. Select the one most appropriate for you.  Again, rates are for the month and pro-rated for actual usage.  So, if you take your app down periodically or only need the services available at certain times, you can bring them down in the Azure portal and you should save that cost.

Web App Params

If you’ve completed all the above steps, then congratulations!  You’ve successfully provisioned your first Azure environment and are ready to deploy an app!

My next post will cover the creation of the project as well as the deployment steps.  If any of you have suggestions around provisioning in Azure or have any questions or comments, please feel free to add them here or address them to john@benedettitech.com.

Thanks for looking in!