Open Azure portal. How to create an Azure account, read my blog here.

Go to Azure Active Directory

Azure Active Directory

Choose App Registrations

App registrations

Click on New application registration

Choose the name for your app, application type and Sign-on URL. It doesn't matter which url you choose and you can always change it later


Click Create

Registered app

Here Application ID is your Service principal client ID

Click on Settings then keys and provide your key name and value. When you click one Save, remember take a good care of your key value. And you can choose when the key will be expired


You have following options for key duration.

Key duration

This is your Service Principal Key

Now we have add Contributor role

Search for your subscription name in Azure Portal


Click on it and go to Access control(IAM)

Access control(IAM)

Click on Add role assignment

Add role assignment

Role should be Contributor, select your app we registered before and click on Save.