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

Create

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

Keys

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

Subscription

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.