Register an Azure Active Directory Security Principal – PowerShell
An Azure service principal is a security identity used by applications, services, and automation tools to access designated Azure resources. The service principal is a ‘user identity’ (username and password) with an assigned role/permissions in Azure Active Directory (AAD). The service principal should only need to do specific things, unlike a general user identity. In this example, a new Service Principal will be created in AAD and assigned to an Azure Resource Group. Read here for the steps to register a new Service Principal using the Azure ARM Portal
Using PowerShell
1. #Login to Azure Subscription
1 |
Connect-AzureRmAccount -Subscription <Your Subscription Name> |
2. #Declare Variables
1 2 3 |
$subscriptionId = <YOUR SUBSCRIPTION ID> $tenantId = <YOUR TENANT ID> $securePassword = ConvertTo-SecureString -AsPlainText -Force -String 'YOUR SECURE PASSWORD OF CHOICE' |