Skip to content

Commit e0457cd

Browse files
Merge pull request #188107 from JnHs/jh-as-spportal
Add portal steps for creating service principal
2 parents baedbf3 + 2f92476 commit e0457cd

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed
38.9 KB
Loading

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

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Connect hybrid machines to Azure at scale
33
description: In this article, you learn how to connect machines to Azure using Azure Arc-enabled servers using a service principal.
4-
ms.date: 08/17/2021
4+
ms.date: 02/10/2022
55
ms.topic: conceptual
66
ms.custom: devx-track-azurepowershell
77
---
@@ -10,23 +10,39 @@ ms.custom: devx-track-azurepowershell
1010

1111
You can enable Azure Arc-enabled servers for multiple Windows or Linux machines in your environment with several flexible options depending on your requirements. Using the template script we provide, you can automate every step of the installation, including establishing the connection to Azure Arc. However, you are required to interactively execute this script with an account that has elevated permissions on the target machine and in Azure.
1212

13-
To connect the machines to Azure Arc-enabled servers, you can use an Azure Active Directory [service principal](../../active-directory/develop/app-objects-and-service-principals.md) instead of using your privileged identity to [interactively connect the machine](onboard-portal.md). A service principal is a special limited management identity that is granted only the minimum permission necessary to connect machines to Azure using the `azcmagent` command. This is safer than using a higher privileged account like a Tenant Administrator, and follows our access control security best practices. The service principal is used only during onboarding, it is not used for any other purpose.
13+
To connect the machines to Azure Arc-enabled servers, you can use an Azure Active Directory [service principal](../../active-directory/develop/app-objects-and-service-principals.md) instead of using your privileged identity to [interactively connect the machine](onboard-portal.md). This service principal is a special limited management identity that is granted only the minimum permission necessary to connect machines to Azure using the `azcmagent` command. This is safer than using a higher privileged account like a Tenant Administrator, and follows our access control security best practices. The service principal is used only during onboarding; it is not used for any other purpose.
1414

15-
The installation methods to install and configure the Connected Machine agent requires that the automated method you use has administrator permissions on the machines. On Linux, by using the root account and on Windows, as a member of the Local Administrators group.
15+
The installation methods to install and configure the Connected Machine agent requires that the automated method you use has administrator permissions on the machines: on Linux by using the root account, and on Windows as a member of the Local Administrators group.
1616

1717
Before you get started, be sure to review the [prerequisites](agent-overview.md#prerequisites) and verify that your subscription and resources meet the requirements. For information about supported regions and other related considerations, see [supported Azure regions](overview.md#supported-regions). Also review our [at-scale planning guide](plan-at-scale-deployment.md) to understand the design and deployment criteria, as well as our management and monitoring recommendations.
1818

1919
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
2020

21-
## Create a Service Principal for onboarding at scale
21+
## Create a service principal for onboarding at scale
2222

23-
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. Or you can follow the steps listed under [Create a Service Principal using the Azure portal](../../active-directory/develop/howto-create-service-principal-portal.md) to complete this task.
23+
You can create a service principal in the Azure portal or by using Azure PowerShell.
2424

2525
> [!NOTE]
26-
> Before you create a service principal, your account must be a member of the **Owner** or **User Access Administrator** role in the subscription that you want to use for onboarding. If you don't have sufficient permissions to configure role assignments, the service principal might be created, but it won't be able to onboard machines.
27-
>
26+
> To create a service principal and assign roles, your account must be a member of the **Owner** or **User Access Administrator** role in the subscription that you want to use for onboarding. If you don't have sufficient permissions to configure role assignments, the service principal might still be created, but it won't be able to onboard machines.
2827
29-
To create the service principal using PowerShell, perform the following steps.
28+
### Azure portal
29+
30+
The Azure Arc service in the Azure portal provides a streamlined way to create a service principal that can be used to connect your hybrid machines to Azure.
31+
32+
1. In the Azure portal, navigate to Azure Arc, then select **Service principals** in the left menu.
33+
1. Select **Add**.
34+
1. Enter a name for your service principal.
35+
1. Choose whether the service principal will have access to an entire subscription, or only to a specific resource group.
36+
1. Select the subscription (and resource group, if applicable) to which the service principal will have access.
37+
1. In the **Client secret** section, select the duration for which your generated client secret will be in use. You can optionally enter a friendly name of your choice in the **Description** field.
38+
1. In the **Role assignment** section, select **Azure Connected Machine Onboarding**.
39+
1. Select **Create**.
40+
41+
:::image type="content" source="media/onboard-service-principal/new-azure-arc-service-principal.png" alt-text="Screenshot of the Azure Arc service principal creation screen in the Azure portal.":::
42+
43+
### Azure PowerShell
44+
45+
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.
3046

3147
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.
3248

@@ -52,18 +68,17 @@ To create the service principal using PowerShell, perform the following steps.
5268
$credential.GetNetworkCredential().password
5369
```
5470
55-
3. In the output, find the password value under the field **password** and copy it. Also find the value under the field **ApplicationId** and copy it also. Save them for later 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.
71+
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.
5672
5773
The values from the following properties are used with parameters passed to the `azcmagent`:
5874
59-
* The value from the **ApplicationId** property is used for the `--service-principal-id` parameter value
60-
* The value from the **password** property is used for the `--service-principal-secret` parameter used to connect the agent.
75+
- The value from the **ApplicationId** property is used for the `--service-principal-id` parameter value
76+
- The value from the **password** property is used for the `--service-principal-secret` parameter used to connect the agent.
6177
62-
> [!NOTE]
78+
> [!TIP]
6379
> Make sure to use the service principal **ApplicationId** property, not the **Id** property.
64-
>
6580
66-
The **Azure Connected Machine Onboarding** role contains only the permissions required to onboard a machine. You can assign the service principal permission to allow its scope to include a resource group or a subscription. To add role assignment, 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).
81+
The **Azure Connected Machine Onboarding** role contains only the permissions required to onboard a machine. You can assign the service principal permission to allow its scope to include a resource group or a subscription. 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).
6782
6883
## Generate the installation script from the Azure portal
6984
@@ -103,28 +118,25 @@ Taking the script template created earlier, you can install and configure the Co
103118
104119
The following are the settings that you configure the `azcmagent` command to use for the service principal.
105120
106-
* `service-principal-id` : The unique identifier (GUID) that represents the application ID of the service principal.
107-
* `service-principal-secret` | The service principal password.
108-
* `tenant-id` : The unique identifier (GUID) that represents your dedicated instance of Azure AD.
109-
* `subscription-id` : The subscription ID (GUID) of your Azure subscription that you want the machines in.
110-
* `resource-group` : The resource group name where you want your connected machines to belong to.
111-
* `location` : See [supported Azure regions](overview.md#supported-regions). This location can be the same or different, as the resource group's location.
112-
* `resource-name` : (*Optional*) Used for the Azure resource representation of your on-premises machine. If you do not specify this value, the machine hostname is used.
121+
- `service-principal-id` : The unique identifier (GUID) that represents the application ID of the service principal.
122+
- `service-principal-secret` | The service principal password.
123+
- `tenant-id` : The unique identifier (GUID) that represents your dedicated instance of Azure AD.
124+
- `subscription-id` : The subscription ID (GUID) of your Azure subscription that you want the machines in.
125+
- `resource-group` : The resource group name where you want your connected machines to belong to.
126+
- `location` : See [supported Azure regions](overview.md#supported-regions). This location can be the same or different, as the resource group's location.
127+
- `resource-name` : (*Optional*) Used for the Azure resource representation of your on-premises machine. If you do not specify this value, the machine hostname is used.
113128
114129
You can learn more about the `azcmagent` command-line tool by reviewing the [Azcmagent Reference](./manage-agent.md).
115130
116131
>[!NOTE]
117132
>The Windows PowerShell script only supports running from a 64-bit version of Windows PowerShell.
118-
>
119133
120134
After you install the agent and configure it to connect to Azure Arc-enabled servers, go to the Azure portal to verify that the server has successfully connected. View your machines in the [Azure portal](https://aka.ms/hybridmachineportal).
121135
122-
![A successful server connection](./media/onboard-portal/arc-for-servers-successful-onboard.png)
136+
![Screenshot showing a successful server connection in the Azure portal.](./media/onboard-portal/arc-for-servers-successful-onboard.png)
123137
124138
## Next steps
125139
126-
- Troubleshooting information can be found in the [Troubleshoot Connected Machine agent guide](troubleshoot-agent-onboard.md).
127-
128140
- 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.
129-
130-
- Learn how to manage your machine using [Azure Policy](../../governance/policy/overview.md), for such things as VM [guest configuration](../../governance/policy/concepts/guest-configuration.md), verify the machine is reporting to the expected Log Analytics workspace, enable monitoring with [VM insights](../../azure-monitor/vm/vminsights-enable-policy.md), and much more.
141+
- Learn how to [troubleshoot agent connection issues](troubleshoot-agent-onboard.md).
142+
- Learn how to manage your machines using [Azure Policy](../../governance/policy/overview.md) for such things as VM [guest configuration](../../governance/policy/concepts/guest-configuration.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.

0 commit comments

Comments
 (0)