Authenticating via Service Principal
- Navigate to the Azure Portal and sign in to your tenant.
- Search for
Azure Active Directory
and open it. - Copy the
Tenant ID
field and save it somewhere safe, making a note it is theARM_TENANT_ID
. - Click
App registrations
in 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
Name
field. - Leave the other settings as default and click
Register
. - Wait for it to be created.
- Copy the
Application (client) ID
field and save it somewhere safe, making a note it is theARM_CLIENT_ID
. - Click
Certificates & secrets
in the left navigation. - Ensure the
Client secrets
tab is selected and click+ New client secret
. - Enter
ALZ Bootstrap
in theDescription
field. - Change the
Expires
field, chooseCustom
. - Set the
Start
field to todays date. - Set the
End
field to tomorrows date. - Click
Add
. - Copy the
Value
field 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
Subscriptions
and 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
+ Add
and chooseAdd role assignment
. - Choose the
Privileged administrator roles
tab. - Click
Owner
to highlight the row and then clickNext
. - Leave the
User, group or service principal
option checked. - Click
+ Select Members
and search for your SPN in the search box on the right. - Click on your User to highlight it and then click
Select
and then clickNext
. - Click the
Allow user to assign all roles (highly privileged)
option. - Click
Review + assign
, then clickReview + assign
again when the warning appears. - Wait for the role to be assigned and move onto the next subscription.
- Search for
Management Groups
and 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 Group
or a new management group you created). - Click
Access control (IAM)
in the left navigation. - Click
+ Add
and chooseAdd role assignment
. - Choose the
Privileged administrator roles
tab. - Click
Owner
to highlight the row and then clickNext
. - Click
Next
. - Leave the
User, group or service principal
option checked. - Click
+ Select Members
and 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 + assign
again 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_ID
you made a note of earlier. - Type
$env:ARM_TENANT_ID="<tenant id>"
and hit enter. - Find the
ARM_CLIENT_ID
you made a note of earlier. - Type
$env:ARM_CLIENT_ID="<client id>"
and hit enter. - Find the
ARM_CLIENT_SECRET
you 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.