In order for this setup to work you must be an administrator for your azure subscription:

  • Create a new application registration under Azure Active Directory.
  • Generate a key for the application.
  • Assign the application to your azure subscription(s).

The community has put together an excellent how to document which will walk you though the 3 steps mentioned above, this can be found at https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal

After performing all 3 steps, you should gather the following information:

  • Tenant ID/Directory ID: This is found under the Properties blade of the Azure Active Directory
  • Application ID:  This is found under the Properties blade of the Register application
  • Secure Key: This is found and generated under the Keys blade of the Register application

After you’ve gather all the information, plug it into this script and execute it. I’ve tested this on Azure Powershell version 4.0.2. To get your version of Azure Powershell execute the following:

Here is the script to authenticate your service principal: