Click here to Skip to main content
15,887,135 members
Articles / Hosted Services / Azure
Tip/Trick

Creating New Application and Service Principal to Access Resource in Azure

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
23 Jan 2016CPOL2 min read 7.1K   1  
Accessing resources and creating and updating the resources in the Azure resource groups

Introduction

This tip will explain the steps you need to take if you want to write an application or a process which will need to access the Azure resource groups and resources inside it. I will show you how to do it both through powershell (next post) and in this tip through the Azure Portal.

Using any method, either through portal or powershell, the steps will be the same. In general, following are the steps needed:

  1. Create an application reference inside the Active Directory of Azure
  2. Create a service principal for this application
  3. Grant permission for this service principal

Creating AD Application and Service Principal Through Portal

As mentioned above, we need to do the three steps using the portal. Following are the steps to take:

  1. Loging to the old Azure portal
  2. Go to the active directory and then click applications
  3. Create new application

    Image 1

  4. Select Web Application
  5. Put in a sign in url for a website which contains some information about your application. (The urls are not validated and hence we can proceed further without thinking much about it).
    Now we need to generate the authentication for this application. We will use the same application id as the principal name and will generate a password for this and assign a role for this application.
  6. Once the application is created, it will be available in the applications section of the active directory:

    Image 2

  7. Click and select your application and then click the congifure link. Please note down the ClientID as you scroll down the configure page. This ClientID is your service principal. Now you need to generate the password for this client ID.

    Image 3

  8. Inside the application selection page, you need to click the configure option and scroll down to the keys section. Click the 1 year drop down. The keys will be generated once you save these settings.

    Image 4

    The keys generated above is your Password which you need to connect your application to Azure settings.

  9. Switch to the new portal. If you want to give access to a specific resource group, then navigate to the resource group and then access. If you want to give access to everything, then navigate to the subscriptions page and then click access.

    Image 5

  10. Click add new and give the appropriate access level, i.e., reader or contributor and then select your application from the user search. Your application will not be listed among the users so you have to manually type your application name in the search to select it.

    Image 6

  11. Click ok to assign your application to this role and you should now see your application in the list of assigned users.

This concludes this guide on how to make your application authenticate to access Azure resources.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect www.i-arif.com
Pakistan Pakistan
Working as solution architect. Developing solutions based on Microsoft based Technologies.
Have my own blog at
www.i-arif.com

Comments and Discussions

 
-- There are no messages in this forum --