Skip to content

Commit 6588dd7

Browse files
authored
Merge pull request #231843 from rpsqrd/docs-editor/onboard-service-principal-1679581037
Update onboard-service-principal.md
2 parents 29e3680 + 095b601 commit 6588dd7

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

articles/azure-arc/servers/onboard-service-principal.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,41 +53,28 @@ The Azure Arc service in the Azure portal provides a streamlined way to create a
5353

5454
You can use [Azure PowerShell](/powershell/azure/install-az-ps) to create a service principal with the [New-AzADServicePrincipal](/powershell/module/Az.Resources/New-AzADServicePrincipal) cmdlet.
5555

56-
1. Run the following command. You must store the output of the [`New-AzADServicePrincipal`](/powershell/module/az.resources/new-azadserviceprincipal) cmdlet in a variable, or you will not be able to retrieve the password needed in a later step.
57-
56+
1. Check the context of your Azure PowerShell session to ensure you're working in the correct subscription. Use [Set-AzContext](/powershell/module/az.accounts/set-azcontext) if you need to change the subscription.
57+
5858
```azurepowershell-interactive
59-
$sp = New-AzADServicePrincipal -DisplayName "Arc-for-servers" -Role "Azure Connected Machine Onboarding"
60-
$sp
61-
```
62-
63-
```output
64-
Secret : System.Security.SecureString
65-
ServicePrincipalNames : {ad9bcd79-be9c-45ab-abd8-80ca1654a7d1, https://Arc-for-servers}
66-
ApplicationId : ad9bcd79-be9c-45ab-abd8-80ca1654a7d1
67-
ObjectType : ServicePrincipal
68-
DisplayName : Hybrid-RP
69-
Id : 5be92c87-01c4-42f5-bade-c1c10af87758
70-
Type :
59+
Get-AzContext
7160
```
72-
73-
2. To retrieve the password stored in the `$sp` variable, run the following command:
74-
61+
62+
1. Run the following command to create a service principal and assign it the Azure Connected Machine Onboarding role for the selected subscription. After the service principal is created, it will print the application ID and secret. The secret is valid for 1 year, after which you'll need to generate a new secret and update any scripts with the new secret.
63+
7564
```azurepowershell-interactive
76-
$credential = New-Object pscredential -ArgumentList "temp", $sp.Secret
77-
$credential.GetNetworkCredential().password
65+
$sp = New-AzADServicePrincipal -DisplayName "Arc server onboarding account" -Role "Azure Connected Machine Onboarding"
66+
$sp | Format-Table AppId, @{ Name = "Secret"; Expression = { $_.PasswordCredentials.SecretText }}
67+
```
68+
```output
69+
AppId Secret
70+
----- ------
71+
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee PASSWORD_SHOWN_HERE
7872
```
7973
80-
3. In the output, find the values for the fields **password** and **ApplicationId**. You'll need these values later, so save them in a secure place. If you forget or lose your service principal password, you can reset it using the [`New-AzADSpCredential`](/powershell/module/az.resources/new-azadspcredential) cmdlet.
81-
82-
The values from the following properties are used with parameters passed to the `azcmagent`:
83-
84-
- The value from the **ApplicationId** property is used for the `--service-principal-id` parameter value
85-
- The value from the **password** property is used for the `--service-principal-secret` parameter used to connect the agent.
86-
87-
> [!TIP]
88-
> Make sure to use the service principal **ApplicationId** property, not the **Id** property.
89-
90-
4. Assign the **Azure Connected Machine Onboarding** role to the service principal for the designated resource group or subscription. This role contains only the permissions required to onboard a machine. Note that your account must be a member of the **Owner** or **User Access Administrator** role for the subscription to which the service principal will have access. For information on how to add role assignments, see [Assign Azure roles using the Azure portal](../../role-based-access-control/role-assignments-portal.md) or [Assign Azure roles using Azure CLI](../../role-based-access-control/role-assignments-cli.md).
74+
The values from the following properties are used with parameters passed to the `azcmagent`:
75+
76+
- The value from the **AppId** property is used for the `--service-principal-id` parameter value
77+
- The value from the **Secret** property is used for the `--service-principal-secret` parameter used to connect the agent.
9178
9279
## Generate the installation script from the Azure portal
9380
@@ -144,8 +131,21 @@ After you install the agent and configure it to connect to Azure Arc-enabled ser
144131
145132
![Screenshot showing a successful server connection in the Azure portal.](./media/onboard-portal/arc-for-servers-successful-onboard.png)
146133
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
147144
## Next steps
148145
149146
- Review the [Planning and deployment guide](plan-at-scale-deployment.md) to plan for deploying Azure Arc-enabled servers at any scale and implement centralized management and monitoring.
150147
- Learn how to [troubleshoot agent connection issues](troubleshoot-agent-onboard.md).
151148
- Learn how to manage your machines using [Azure Policy](../../governance/policy/overview.md) for such things as VM [guest configuration](../../governance/machine-configuration/overview.md), verifying that machines are reporting to the expected Log Analytics workspace, monitoring with [VM insights](../../azure-monitor/vm/vminsights-enable-policy.md), and more.
149+
```
150+
151+
```

0 commit comments

Comments
 (0)