I was creating ARM based service deployment end points often and I thought I might as well document this for my own reference. The
following are the steps I did to create ARM service end points in VSTS.
- First open up the Microsoft Azure PowerShell command prompt window.
- Login to the Azure Account using “Add-AzureRmAccount”
- Make sure you are in the correct tenant/subscription (Replace xxxx with the correct values for your subscription – you can get your subscription ID by logging into the Azure portal and going to the subscription tab)
PS C:\users\gpillai.000\Downloads> Add-AzureRmAccount -SubscriptionId 6xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx2
Environment : AzureCloud
Account : firstname.lastname@example.org
TenantId : dxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
SubscriptionId : 6xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx2 (Check this)
4. Download the SPNCreation.ps1 from https://blogs.msdn.microsoft.com/visualstudioalm/2015/10/04/automating-azure-resource-group-deployment-using-a-service-principal-in-visual-studio-online-buildrelease-management/
5. Open a PS command window and run Set-Executionpolicy to unrestricted as shown below .
6. Run the SPNCreation.ps1 script as shown below:-
Now at the end of this exercise you will have an output for the following set of properties, which you will then use in the Azure VSTS portal to set up your ARM end point.
(a) Connection Name
(b) Subscription Id
(c) Subscription Name
(d) Service Principal Id
(e) Service Principal Key
(f) Tenant Id
7. Now go the Project in VSTS and click on the Admin (Gear) icon the right to take you to the Administrator portal.
8. Click on Services Tab and then on Azure Resource Manager (click on below pic for a clearer image)
9. This will open the form to fill up the values that were generated/given to you when you ran the SPNCreation.ps1 script as shown in the end of Step#6. This will then generate the required Service end point for you.
Now you can use this service end point in ARM based deployments.