A better way (and script) to add a Service Principal in Azure for VSTS

From Visual Studio Team Services (VSTS) it’s possible to deploy to an Azure Subscription using an Active Directory Service Principal.

The Microsoft documentation refers to a blog post which describes a 3-clicks and a manual way to setup this principal.

Although the information on the blog post for the 3-clicks setup is still actual, the script link provided for the manual configuration is not available anymore (not found, probably because the Git repo has been moved/renamed).

For both the suggested ways (3-clicks or manual), there are some concerns from my side about the principal setup, which I think they could be improved:

  • The principal which is created during the process gets the “Contributor” role granted on the whole Azure subscription, and using the manual powershell script, the default role is even “Owner” (this can be modified).
  • The name of the Active Directory Application/Principal is some random guid which is difficult to be identified, see this picture:

Read more →

Demystifying .NET Core SDK versions

Last night I was developing some code in .NET Core for the Dutch Azure Meetup and I was (again) encountering versioning problems and unexpected behavior.

I found this blog post which describes in some way the same problem I had.

Update 13-01-2017: I found this blog which also describes very well the issue.

What the blog post says is that if you use:

dotnet new

and you want use a specific version of .NET Core SDK you should add a global.json file (before executing the “dotnet new” command) like this:

{
 "sdk": {
 "version": "1.0.0-preview2-003121"
 }
}

The SDK’s in Windows are installed in the Program Files folder (or Program Files (x86) if you have a 32bit Windows) so let’s take a look there:

Read more →

Solve 401 (Unauthorized) error when restoring packages using VSTS Package Management and .NET Core

For the quick answer jump directly to the conclusion

Yesterday I was setting up the build for an ASP .NET Core (Web API) application I wrote, this application was using a package from the VSTS Package Management repository.

To setup this build I was using the new dotnet Core tooling (in preview) which is available when creating a new Build Definition:

Read more →

Setting up VSTS with ARM Templates

In this post I want to show you what I think it’s the best way to setup VSTS working with Azure Resource Manager Templates.

Introduction

At the customer I am currently working for, we are setting up a new Azure Big Data ingestion environment and we wanted to do it using the Infrastructure as Code approach. With Azure this obviously goes with ARM Templates.

For source control, build and deployment we use Visual Studio Team Services (VSTS).

About VSTS, Build and Release Management

I have seen different setups with VSTS, some of them where the deployment take place from the build, or directly in Release Management without a build.

My approach is to have a clear separation of concerns between the Build and the Release Management.
The Build is for compiling, (Unit) Testing and creating artifacts for the deployment.
The Release Management’s responsibility is for deploying the artifacts created during the Build process.

Let’s begin

For this post I’m using ARM Linked Template, and the templates will create a Storage Account, an App Service Plan, an App Service and an Application Insight Resources.

Read more →

VSTS Task delete Resource Group if empty

When testing deployments of Azure RM resources (ie. using the Test-AzureRmResourceGroupDeployment powershell cmdlet) an empty Resource Group is created. This Resource Group is often not needed at this point and can be deleted after you are done testing the deployment of the resources. For deleting the Resource Group you can use the VSTS task delete resource group if empty. This tasks deletes the Resource Group only if it does not contains any resources.

 

 

Dutch Azure Meetup

Dutch Azure Meetuo LogoThis week Pascal Naber, Sander Molenkamp and I started the Dutch Azure Meetup: http://www.meetup.com/Dutch-Azure-Meetup/

Azure offers a lot of services and features, and this grows almost daily. It’s hard to be up-to-date on all the Azure features. This meetup gives you the opportunity to learn about Azure in a practical way.

We want to offer a platform for Azure enthusiasts, where you can get hands-on with the technology, talk with and learn from each other. The meetup will not handle customer cases in theory but instead we talk about deep technical details, real world experiences and best practices.

Our first meetup is planned for the 2nd of June and is all about Azure Container Service:

Join the first Dutch Azure Meetup!

Docker is taking the world by storm and Microsoft Azure Container Service is where Azure and Docker meet!

During this first meetup Mark van Holsteijn will give you a brief introduction into Docker and Microsoft Container Service.After which you will have ample opportunity to get hands-on with Docker, Marathon, Azure and ASP.NET core.

We will show you how Azure Container Service provides an excellent platform for creating cross-cloud applications.

About the speaker

Mark van Holsteijn is Principal Consultant at Xebia specialized in cloud software architectures with open-source technologies.

Agenda

18:00: Dinner

18:45: Word of welcome Dutch Azure Meetup

18:50: Azure Container Service (by Mark van Holsteijn)

19:30: Hands-on with Docker and Azure Container Service

Get subscription id in an Azure Resource Manager Template

Recently I was writing an Azure Resource Manager Template to deploy a Web App. The Web App needed some Application settings (like connection strings, etc..) which I wanted to provision during the Resource Manager Template deployment. One of the settings needed was the Azure subscription id where the Web App was created.
I didn’t want to hardcode the subscription id, or provide it through a parameter (which is a way to postpone the hard-coding), so I did a little research and I found the solution.

In Azure RM Template you can use Resource Functions which can evaluate during the deployment run-time settings.

The one I needed was subscription()  which has the following structure:

{
    "id": "/subscriptions/#####",
    "subscriptionId": "#####",
    "tenantId": "#####"
}

This means you can use the function like this:

"parameters": { 
  "siteName": {
      "type": "string"
  }
},
"resources": [
   {
      "apiVersion": "2014-06-01",
      "name": "[parameters('siteName')]",
      "type": "Microsoft.Web/Sites",
        "properties": {
            "subscriptionid": "[subscription().subscriptionId]",
            "AzureWebJobsDashboard": "xxxx",
            "AzureWebJobsStorage": "xxxx"
        }
   }
]

There are more nice functions you may need to use like: resourceGroup()resourceId ([resourceGroupName], resourceType, resourceName1, [resourceName2]…).

HDInsight error with external metastore (Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient)

Recently I was working to setup a Big Data environment in Azure.
From Azure Data Factory I was spinning up an on-demand HDInsight Cluster with an external metastore.

Unfortunately I was always getting the following error: “Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient”.
After contacting Microsoft for support about this error they found the error was caused by a known Hadoop bug:
https://issues.apache.org/jira/browse/HIVE-12536

Read more →

Access Synology DSM from the internet with a Reverse Proxy

Update:

For DSM 5 the paths are changed:

  • DSM 4: /usr/syno/etc/httpd-ssl-vhost.conf-user
  • DSM 5: /etc/httpd/sites-enabled-user/httpd-ssl-vhost.conf-user

I want to be able to access my Synology Disk Station Management (DSM) from the internet in a secure way through https.

DSM is standard running on the Synology in https mode on port 5001, so we need to setup a reverse proxy in apache:

Access the Synology with SSH using Putty, en type the following commands in the shell prompt to navigate to the right folder:

For DSM 4:

cd /usr/syno/etc/

For DSM 5:

cd /etc/httpd/sites-enabled-user/

Read more →