Archive

Archive for the ‘Azure’ Category

Azure Service Configuration and Definition files

I’m now working towards my 70-533 Implementing Microsoft Azure Infrastructure Solutions and one thing that throws me is the difference between what is held in the Service Definition (.csdef) and Service Configuration (.cscfg) files.

A good write up is found here What is the Cloud Service model and how do I package it?

Service Definition Files (.csdef)

These hold

  • Web Roles
    • Sites
      • Bindings
    • Endpoints
      • InputEdnpoint
      • InternalEndpoint
    • Certificates
    • Imports
    • LocalResources
      • LocalStorage
    • StartUp
      • Task
  • WorkerRole
    • ConfigurationSettings
    • Imports
    •  Endpoints
      • InputEdnpoint
      • InternalEndpoint

Service Configuration Files (.cscfg)

These hold

  • Role
    • Instances
  • ConfigurationSettigs
  • Certificates

Service Package Files (.cspkg)

These hold the packaged application in a single compressed archive file.

Categories: Azure Tags: ,

Exposing Azure Web Site slot specific variables in a .Net Core ASP 1.1 MVC Web Application

Try saying that five times very fast.

It all started simply enough as I go through my Azure development exams in particular the Developing Microsoft Azure Solutions 70-532.

All I needed was to understand how Azure Deployment Slot Specific App Settings worked.  I had read it up but wanted to see it in action.

How hard could it be?

As it turns out not too bad when you understand it but there were two things I hadn’t appreciated.

  1. ASP.NET Core 1.1 uses a different mechanism for application settings.
  2. The way that Azure represents deployment slots in the portal.

ASP.NET Core 1.1 Application Settings

In a nutshell web.config is no longer available and you should use an alternative mechanism such as an appsettings.json file.  For a good write up see here

New Configuration and AppSettings for MVC6 – Web.config is Gone

Its all really good news in this is that the new way of doing things frees us from the tyranny of named files and opens up dependency injection, combining multiple files, overrides at runtime, secure secret stores.  It is a good thing but first you must get your head above it.

Azure Deployment Slot Portal Representation

I assumed that the deployment slots would be a child of the web site in the Azure portal but this is not the case.  Instead each slot is its own web site with links between them.  This does make sense as that is what they really are a set of web sites with arbitrary links between them.  Those parts that are hosted on the same VM under the hood share their settings so that updating one will update all of them whilst those that are slot specific do not affect each other.

In the end a solid day of digging got me to the bottom of this and a better understanding of how Azure is put together.

Categories: Azure, Deployment, Development Tags:

Using Git as a Repository from Visual Studio

Nice and simple this one.

Why Git and not TFS?  Well its the current de facto repository so why not use it.

  • Commit your changes
  • Sync
  • Set up the login to TFS Online.

Done.

Categories: Azure Tags: ,

Configuring deployment slots

So we have a default web site now and we want to change it so that it reflects our company.  However rather than just do a publish ideally we want to be able to deploy the changes where they can be tested and rolled back if necessary.

So we use deployment slots.

The first thing is that in order to use deployment slots we need to be in at least a standard tier so we need to change the web hosting plan through the portal.

  • Log into the azure portal (https://portal.azure.com)
  • Select the App Service Plan as it effectively maps to a set of Virtual Machines which we can change from the Free type to a dedicated standard VM.  Use the Scale Up option to do this.  I need a minimum of Standard mode to get deployment slots so I’ll pick S1 Standard, the smallest standard mode.
  • This may well change the web sites IP Address but as I’m not using custom domains it doesn’t matter yet.
  • Select the App Service.
  • Select Add Slot.
  • In Visual Studio reconfigure Publish to publish to staging, again later on we’ll configure team services to do the deploy automatically on check in.
    • Select Publish
    • Create a new profile
    • Select the resource group and deployment slot, do not try and modify it yourself as things like the user name and password will be different.
  • Publish the web site

And it works we now have two identical versions of the site at two different web addresses.

I then made a change just tidying up the title of the site and redeployed it to staging.

Now to swap the slots we need to

  • Log onto the azure portal
  • Select the web site (not the deployment slot)
  • Select Deployment slots
  • Select swap
    • Swap type: Swap
    • Source: Production
    • Destination: Staging
    • OK
  • Refresh the browsers showing the production and staging sites (you may need a CTRL-F5)

And again it just worked.

 

Categories: Azure Tags:

Creating an Azure Core Web Application Development Environment

So lets get started with creating our new company web site.  I’m going to use an ASP.NET Core Web Application because:

  • It’s the way forward according to Microsoft.
  • We don’t need the site immediately so if there are teething issues we can live with the old site.

First thing lets make sure that the copy of Visual Studio is absolutely up to date.  The time to do this is before you start a new project because often their are changes to how things are created and few packages are as good at updating existing projects as they are at creating new ones and also once in progress the decision to upgrade components becomes a serious decision especially when there are multiple developers or machines that must all be patched to the same level.

Once this was done I set up the web site by choosing the ASP.NET Core Web Application project type and using all the defaults (I have given up trying to guess what to change as generally the default settings on a project will give the fewest issues when getting the project off the ground) except:

  • Project Name: SimpleInnovationWeb (No default)
  • Solution Name: SimpleInnovation (Changed as I know that eventually there will be more than one project in this solution so I can test complex deployments)
  • Hosting Options: Free (Changed as I want to test upgrading and downgrading the hosting)

Everything installed correctly so with no further changes I ran the project in debug mode.

And it all worked.

Emboldened I published it to Azure via the Publish option in Visual Studio accepting all the defaults.

And it all just worked.

So far so good.

Categories: Azure Tags:

Creating an Azure Subscription

Today’s task as I get up to speed with passing my Azure Certification was to create an Azure Subscription to use to host the company’s web site on, one of the prerequisites for the Microsoft BizSpark program.

Its easy enough.  We already have an Office 365 subscription so that also gives us access to the Azure Portal (https://account.windowsazure.com/Subscriptions).  Select Add a Microsoft Azure Subscription and follow the wizard.

I selected Free Trial which gives me £125 of free credit for the next 30 days.

Good now I can start deploying and testing resources.

 

Categories: Azure Tags:

How to master Azure

So I’m working on getting my Azure certification and, as others have found, that’s a tall order. Its the sheer size of the thing. Really you have to be full stack for this as its not enough to know just web site creation you need to understand Infrastructure, Automation, Networking, Reliability, Availability, Maintenance and everything that relates to running your own data centre.

A tall order.

I started with https://mva.microsoft.com/en-US/training-courses/microsoft-azure-fundamentals-8391 Microsoft Azure Fundamentals and as Bob Tabor (https://twitter.com/@bobtabor) mentions in that the best way is not to try and learn it all but think about how you would actually use it and from that try it out and learn by doing so it has actual meaning.

One of the tasks on my plate for the last year has been redeveloping our web site (http://www.simpleinnovation.co.uk/) as it currently runs on SharePoint Online and this facility gets withdrawn this year (https://support.microsoft.com/en-gb/kb/3027254) starting in March 2017.

So I’ve decided the time has come to make it an Azure web site. That way I get first hand experience of using the Azure services.

Cheers

Sebastian

Categories: Azure Tags: