Authenticating via Service Principal
Skip this if using a User account as recommended.
- Navigate to the Azure Portal and sign in to your tenant.
- Search for
Entra IDand open it. - Copy the
Tenant IDfield and save it somewhere safe, making a note it is theARM_TENANT_ID. - Click
App registrationsin the left navigation. - Click
+ New registration. - Choose a name (SPN) that you will remember and make a note of it, we recommend using
sp-alz-bootstrap. - Type the chosen name into the
Namefield. - Leave the other settings as default and click
Register. - Wait for it to be created.
- Copy the
Application (client) IDfield and save it somewhere safe, making a note it is theARM_CLIENT_ID. - Click
Certificates & secretsin the left navigation. - Ensure the
Client secretstab is selected and click+ New client secret. - Enter
ALZ Bootstrapin theDescriptionfield. - Change the
Expiresfield, chooseCustom. - Set the
Startfield to todays date. - Set the
Endfield to tomorrows date. - Click
Add. - Copy the
Valuefield save it somewhere safe, making a note that it is theARM_CLIENT_SECRET.
- The service principal name (SPN) is the username of the User account or the name of the app registration you created.
- Search for
Subscriptionsand click to navigate to the subscription view. - For each of the subscriptions you created in the previous step:
- Navigate to the subscription.
- Click
Access control (IAM)in the left navigation. - Click
+ Addand chooseAdd role assignment. - Choose the
Privileged administrator rolestab. - Click
Ownerto highlight the row and then clickNext. - Leave the
User, group or service principaloption checked. - Click
+ Select Membersand search for your SPN in the search box on the right. - Click on your User to highlight it and then click
Selectand then clickNext. - Click the
Allow user to assign all roles (highly privileged)option. - Click
Review + assign, then clickReview + assignagain when the warning appears. - Wait for the role to be assigned and move onto the next subscription.
- Search for
Management Groupsand click to navigate to the management groups view. - Click the parent management group you plan to deploy the Landing Zone into (this could be
Tenant Root Groupor a new management group you created). - Click
Access control (IAM)in the left navigation. - Click
+ Addand chooseAdd role assignment. - Choose the
Privileged administrator rolestab. - Click
Ownerto highlight the row and then clickNext. - Click
Next. - Leave the
User, group or service principaloption checked. - Click
+ Select Membersand search for your SPN in the search box on the right. - Click on your User to highlight it and then click
Select. - Click
Review + assign, then clickReview + assignagain when the warning appears. - Wait for the role to be assigned and you are done with this part.
- Open a new PowerShell Core (pwsh) terminal.
- Find the
ARM_TENANT_IDyou made a note of earlier. - Type
$env:ARM_TENANT_ID="<tenant id>"and hit enter. - Find the
ARM_CLIENT_IDyou made a note of earlier. - Type
$env:ARM_CLIENT_ID="<client id>"and hit enter. - Find the
ARM_CLIENT_SECRETyou made a note of earlier. - Type
$env:ARM_CLIENT_SECRET="<client id>"and hit enter. - Find the subscription id of the management subscription you made a note of earlier.
- Type
$env:ARM_SUBSCRIPTION_ID="<subscription id>"and hit enter.
If you close your PowerShell prompt prior to running the bootstrap, you need to re-enter these environment variables.
Return to Phase 1 step version control systems.