Skip to content

Commit 7d32f10

Browse files
author
Kimmo Forss
committed
Add a section on MSI
1 parent bbd136b commit 7d32f10

File tree

2 files changed

+127
-16
lines changed

2 files changed

+127
-16
lines changed

articles/sap/automation/get-started.md

Lines changed: 126 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,124 @@ Get started quickly with [SAP Deployment Automation Framework](deployment-framew
1919
To get started with SAP Deployment Automation Framework, you need:
2020

2121
- An Azure subscription. If you don't have an Azure subscription, you can [create a free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
22-
- An SAP USer account with permissions to [download the SAP software](software.md) in your Azure environment. See [SAP S-User](https://support.sap.com/en/my-support/users/welcome.html) for more information.
22+
- An SAP User account with permissions to [download the SAP software](software.md) in your Azure environment. For more information on S-User, see [SAP S-User](https://support.sap.com/en/my-support/users/welcome.html).
2323
- An [Azure CLI](/cli/azure/install-azure-cli) installation.
24-
- A service principal to use for the control plane deployment.
25-
- A service principal to use for the workload zone deployment.
24+
- A user Assigned Identity (MS) or a service principal to use for the control plane deployment.
25+
- A user Assigned Identity (MS) or a A service principal to use for the workload zone deployment.
2626
- An ability to create an Azure DevOps project if you want to use Azure DevOps for deployment.
2727

28-
Some of the prerequisites might already be installed in your deployment environment. Both Azure Cloud Shell and the deployer have Terraform and the Azure CLI installed.
28+
Some of the prerequisites might already be installed in your deployment environment. Both Azure Cloud Shell and the deployer come with Terraform and the Azure CLI installed.
29+
30+
### Create a service principal
31+
32+
The SAP automation deployment framework uses service principals for deployment.
33+
34+
When you choose a name for your service principal, make sure that the name is unique within your Azure tenant. Make sure to use an account with service principals creation permissions when running the script.
35+
36+
1. Create the service principal with Contributor permissions.
37+
38+
```cloudshell-interactive
39+
export ARM_SUBSCRIPTION_ID="<subscriptionId>"
40+
export control_plane_env_code="LAB"
41+
42+
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/$ARM_SUBSCRIPTION_ID" --name="$control_plane_env_code-Deployment-Account"
43+
```
44+
45+
Review the output. For example:
46+
47+
```json
48+
{
49+
"appId": "<AppId>",
50+
"displayName": "<environment>-Deployment-Account ",
51+
"name": "<AppId>",
52+
"password": "<AppSecret>",
53+
"tenant": "<TenantId>"
54+
}
55+
```
56+
57+
1. Copy the output details. Make sure to save the values for `appId`, `password`, and `Tenant`.
58+
59+
The output maps to the following parameters. You use these parameters in later steps, with automation commands.
60+
61+
| Parameter input name | Output name |
62+
|--------------------------|-----------------|
63+
| `spn_id` | `appId` |
64+
| `spn_secret` | `password` |
65+
| `tenant_id` | `tenant` |
66+
67+
1. Optionally, assign the User Access Administrator role to the service principal.
68+
69+
```cloudshell-interactive
70+
export appId="<appId>"
71+
72+
az role assignment create --assignee $appId --role "User Access Administrator" --scope /subscriptions/$ARM_SUBSCRIPTION_ID
73+
```
74+
75+
76+
> [!IMPORTANT]
77+
> If you don't assign the User Access Administrator role to the service principal, you can't assign permissions using the automation framework.
78+
79+
### Create a user assigned Identity
80+
81+
82+
The SAP automation deployment framework can also use a user assigned identity (MSI) for the deployment. Make sure to use an account with permissions to create managed identities when running the script that creates the identity.
83+
84+
85+
1. Create the managed identity.
86+
87+
```cloudshell-interactive
88+
export ARM_SUBSCRIPTION_ID="<subscriptionId>"
89+
export control_plane_env_code="LAB"
90+
91+
az identity create --name ${control_plane_env_code}-Deployment-Identity --resource-group <ExistingResourceGroup>
92+
```
93+
94+
Review the output. For example:
95+
96+
```json
97+
{
98+
"clientId": "<appId>",
99+
"id": "<armId>",
100+
"location": "<location>",
101+
"name": "${control_plane_env_code}-Deployment-Identity",
102+
"principalId": "<objectId>",
103+
"resourceGroup": "<ExistingResourceGroup>",
104+
"systemData": null,
105+
"tags": {},
106+
"tenantId": "<TenantId>",
107+
"type": "Microsoft.ManagedIdentity/userAssignedIdentities"
108+
}
109+
```
110+
111+
1. Copy the output details.
112+
113+
The output maps to the following parameters. You use these parameters in later steps, with automation commands.
114+
115+
| Parameter input name | Output name |
116+
|--------------------------|-----------------|
117+
| `app_id` | `appId` |
118+
| `msi_id` | `armId` |
119+
120+
121+
1. Assign the Contributor role to the identity.
122+
123+
```cloudshell-interactive
124+
export appId="<appId>"
125+
126+
az role assignment create --assignee $appId --role "Contributor" --scope /subscriptions/$ARM_SUBSCRIPTION_ID
127+
```
128+
129+
1. Optionally, assign the User Access Administrator role to the identity.
130+
131+
```cloudshell-interactive
132+
export appId="<appId>"
133+
134+
az role assignment create --assignee $appId --role "User Access Administrator" --scope /subscriptions/$ARM_SUBSCRIPTION_ID
135+
```
136+
137+
138+
> [!IMPORTANT]
139+
> If you don't assign the User Access Administrator role to the managed identity, you can't assign permissions using the automation framework.
29140
30141
## Use SAP Deployment Automation Framework from Azure DevOps Services
31142
@@ -51,34 +162,34 @@ Open PowerShell ISE and copy the following script and update the parameters to m
51162
$Env:SDAF_ControlPlaneSubscriptionID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
52163
$Env:SDAF_WorkloadZoneSubscriptionID = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
53164
$Env:ARM_TENANT_ID="zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz"
54-
165+
55166
$UniqueIdentifier = Read-Host "Please provide an identifier that makes the service principal names unique, for instance a project code"
56-
167+
57168
$confirmation = Read-Host "Do you want to create a new Application registration (needed for the Web Application) y/n?"
58169
if ($confirmation -eq 'y') {
59170
$Env:SDAF_APP_NAME = $UniqueIdentifier + " SDAF Control Plane"
60171
}
61-
172+
62173
else {
63174
$Env:SDAF_APP_NAME = Read-Host "Please provide the Application registration name"
64175
}
65-
176+
66177
$confirmation = Read-Host "Do you want to create a new Service Principal for the Control plane y/n?"
67178
if ($confirmation -eq 'y') {
68179
$Env:SDAF_MGMT_SPN_NAME = $UniqueIdentifier + " SDAF " + $Env:SDAF_CONTROL_PLANE_CODE + " SPN"
69180
}
70181
else {
71182
$Env:SDAF_MGMT_SPN_NAME = Read-Host "Please provide the Control Plane Service Principal Name"
72183
}
73-
184+
74185
$confirmation = Read-Host "Do you want to create a new Service Principal for the Workload zone y/n?"
75186
if ($confirmation -eq 'y') {
76187
$Env:SDAF_WorkloadZone_SPN_NAME = $UniqueIdentifier + " SDAF " + $Env:SDAF_WORKLOAD_ZONE_CODE + " SPN"
77188
}
78189
else {
79190
$Env:SDAF_WorkloadZone_SPN_NAME = Read-Host "Please provide the Workload Zone Service Principal Name"
80191
}
81-
192+
82193
if ( $PSVersionTable.Platform -eq "Unix") {
83194
if ( Test-Path "SDAF") {
84195
}
@@ -94,15 +205,15 @@ Open PowerShell ISE and copy the following script and update the parameters to m
94205
New-Item -Path $sdaf_path -Type Directory
95206
}
96207
}
97-
208+
98209
Set-Location -Path $sdaf_path
99-
210+
100211
if ( Test-Path "New-SDAFDevopsProject.ps1") {
101212
remove-item .\New-SDAFDevopsProject.ps1
102213
}
103-
214+
104215
Invoke-WebRequest -Uri https://raw.githubusercontent.com/Azure/sap-automation/main/deploy/scripts/New-SDAFDevopsProject.ps1 -OutFile .\New-SDAFDevopsProject.ps1 ; .\New-SDAFDevopsProject.ps1
105-
216+
106217
```
107218

108219
Run the script and follow the instructions. The script opens browser windows for authentication and for performing tasks in the Azure DevOps project.
@@ -142,7 +253,7 @@ You can then install the deployer components by using the following commands:
142253

143254
```bash
144255

145-
wget https://raw.githubusercontent.com/Azure/sap-automation/main/deploy/scripts/configure_deployer.sh -O configure_deployer.sh
256+
wget https://raw.githubusercontent.com/Azure/sap-automation/main/deploy/scripts/configure_deployer.sh -O configure_deployer.sh
146257
chmod +x ./configure_deployer.sh
147258
./configure_deployer.sh
148259

articles/sap/automation/plan-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ The following table shows the required permissions for the service principals.
232232
> | Workload Zone SPN | SAP library `sapbits` storage account | Reader | |
233233
> | Workload Zone SPN | Private DNS zone | Private DNS zone contributor | |
234234
> | Web Application Identity | Target subscription | Reader | |
235-
> | Cluster Virtual Machine Identity | Resource group | Fencing role |
235+
> | Cluster Virtual Machine Identity | Resource group | Fencing role | |
236236
237237
### Firewall configuration
238238

0 commit comments

Comments
 (0)