Skip to content

Commit d6439d8

Browse files
committed
rbac
1 parent 4aa915a commit d6439d8

File tree

1 file changed

+75
-69
lines changed

1 file changed

+75
-69
lines changed
Lines changed: 75 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,139 @@
11
---
2-
title: Understand Device Update for IoT Hub authentication and authorization
3-
description: Understand how Device Update for IoT Hub uses Azure RBAC to provide authentication and authorization for users and service APIs.
2+
title: Azure RBAC and Azure Device Update for IoT Hub
3+
description: Understand how Azure Device Update for IoT Hub uses Azure role-based access control (Azure RBAC) to provide authentication and authorization for users and service APIs.
44
author: vimeht
55
ms.author: vimeht
6-
ms.date: 10/21/2022
6+
ms.date: 01/13/2025
77
ms.topic: concept-article
88
ms.service: azure-iot-hub
99
ms.subservice: device-update
1010
---
1111

12-
# Azure role-based access control (RBAC) and Device Update
12+
# Azure Device Update for IoT Hub and Azure RBAC
1313

14-
Device Update uses Azure RBAC to provide authentication and authorization for users and service APIs. In order for other users and applications to have access to Device Update, users or applications must be granted access to this resource. It is also necessary to [configure access for Azure Device Update service principal](./device-update-control-access.md#configuring-access-for-azure-device-update-service-principal-in-the-iot-hub) for successfully deploying updates and managing your devices.
14+
For users and applications to access Azure Device Update for IoT Hub, they must be granted access to the Device Update resource. You must also configure access for the Device Update service principal to access the IoT hub to deploy updates and manage devices. This article explains how Device Update uses Azure role-based access control (Azure RBAC) to provide authentication and authorization for users and service APIs.
1515

16-
## Configure access control roles
16+
## Device Update access control roles
1717

18-
These are the roles that are supported by Device Update:
18+
Device Update supports the following RBAC roles:
1919

2020
| Role Name | Description |
2121
| :--------- | :---- |
2222
| Device Update Administrator | Has access to all Device Update resources |
2323
| Device Update Reader| Can view all updates and deployments |
2424
| Device Update Content Administrator | Can view, import, and delete updates |
2525
| Device Update Content Reader | Can view updates |
26-
| Device Update Deployments Administrator | Can manage deployment of updates to devices|
26+
| Device Update Deployments Administrator | Can manage deployments of updates to devices|
2727
| Device Update Deployments Reader| Can view deployments of updates to devices |
2828

29-
A combination of roles can be used to provide the right level of access. For example, a developer can import and manage updates using the Device Update Content Administrator role, but needs a Device Update Deployments Reader role to view the progress of an update. Conversely, a solution operator with the Device Update Reader role can view all updates, but needs to use the Device Update Deployments Administrator role to deploy a specific update to devices.
29+
You can assign a combination of roles to provide the right level of access. For example, the Device Update Content Administrator role can import and manage updates, but you need the Device Update Deployments Reader role to view the progress of an update. Conversely, the Device Update Reader role can view all updates, but you need the Device Update Deployments Administrator role to deploy a specific update to devices.
3030

31-
## Configuring access for Azure Device Update service principal in the IoT Hub
31+
## Device Update service principal access to IoT Hub
3232

33-
Device Update for IoT Hub communicates with the IoT Hub for deployments and manage updates at scale. In order to enable Device Update to do this, users need to set IoT Hub Data Contributor access for Azure Device Update Service Principal in the IoT Hub permissions.
33+
Device Update communicates with the IoT hub for deployments and to manage updates at scale. To enable this communication, you need to use the IoT hub access permissions to grant IoT Hub Data Contributor access to the Device Update service principal.
3434

35-
Deployment, device and update management and diagnostic actions will not be allowed if these permissions are not set. Operations that will be blocked will include:
36-
* Create Deployment
37-
* Cancel Deployment
38-
* Retry Deployment
39-
* Get Device
35+
You must set these permissions to allow the following deployment, device and update management, and diagnostic actions:
4036

41-
The permission can be set from IoT Hub Access Control (IAM). Refer to [Configure Access for Azure Device update service principal in linked IoT hub](configure-access-control-device-update.md#configure-access-for-azure-device-update-service-principal-in-linked-iot-hub)
37+
- Create deployment
38+
- Cancel deployment
39+
- Retry deployment
40+
- Get device
4241

43-
## Authenticate to Device Update REST APIs
42+
You can set this permission from the IoT hub access control (IAM) page. For more information, see [Configure IoT hub access for the Device Update service principal](configure-access-control-device-update.md#configure-access-for-azure-device-update-service-principal-in-linked-iot-hub).
43+
44+
## Device Update REST APIs
4445

4546
Device Update uses Microsoft Entra ID for authentication to its REST APIs. To get started, you need to create and configure a client application.
4647

4748
<a name='create-client-azure-ad-app'></a>
49+
### Create a client Microsoft Entra app
4850

49-
### Create client Microsoft Entra app
50-
51-
To integrate an application or service with Microsoft Entra ID, first [register a client application with Microsoft Entra ID](../active-directory/develop/quickstart-register-app.md). Client application setup will vary depending on the authorization flow you'll need (users, applications or managed identities). For example, to call Device Update from:
51+
To integrate an application or service with Microsoft Entra ID, first [register a client application with Microsoft Entra ID](../active-directory/develop/quickstart-register-app.md). Client application setup varies depending on the authorization flow you need: users, applications, or managed identities. For example:
5252

53-
* Mobile or desktop application, add **Mobile and desktop applications** platform with `https://login.microsoftonline.com/common/oauth2/nativeclient` for the Redirect URI.
54-
* Website with implicit sign-on, add **Web** platform and select **Access tokens (used for implicit flows)**.
53+
- To call Device Update from a mobile or desktop application, add **Mobile and desktop applications** platform with `https://login.microsoftonline.com/common/oauth2/nativeclient` for the redirect URI.
54+
- To call Device Update from a website with implicit sign-on, add **Web** platform and select **Access tokens (used for implicit flows)**.
5555

5656
>[!NOTE]
57-
>Microsoft recommends that you use the most secure authentication flow available. Implicit flow authentication requires a very high degree of trust in the application, and carries risks that are not present in other flows. You should only use this flow when other more secure flows, such as managed identities, aren't viable.
57+
>Use the most secure authentication flow available. Implicit flow authentication requires a high degree of trust in the application, and carries risks that aren't present in other flows. You should use this flow only when other more secure flows, such as managed identities, aren't viable.
5858
5959
### Configure permissions
6060

61-
Next, add permissions for calling Device Update to your app:
61+
Next, grant permissions to your app to call Device Update.
6262

6363
1. Go to the **API permissions** page of your app and select **Add a permission**.
64-
2. Go to **APIs my organization uses** and search for **Azure Device Update**.
65-
3. Select **user_impersonation** permission and select **Add permissions**.
64+
1. Go to **APIs my organization uses** and search for **Azure Device Update**.
65+
1. Select **user_impersonation** permission and select **Add permissions**.
6666

6767
### Request authorization token
6868

69-
The Device Update REST API requires an OAuth 2.0 authorization token in the request header. The following sections show some examples of ways to request an authorization token.
69+
The Device Update REST API requires an OAuth 2.0 authorization token in the request header. The following sections show examples of some ways to request an authorization token.
7070

71-
#### Using Azure CLI
71+
#### Azure CLI
7272

7373
```azurecli
7474
az login
7575
az account get-access-token --resource 'https://api.adu.microsoft.com/'
7676
```
7777

78-
#### Using PowerShell MSAL Library
78+
#### PowerShell MSAL Library
7979

80-
[MSAL.PS](https://github.com/AzureAD/MSAL.PS) PowerShell module is a wrapper over [Microsoft Authentication Library for .NET (MSAL .NET)](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet). It supports various authentication methods.
80+
[MSAL.PS](https://github.com/AzureAD/MSAL.PS) PowerShell module is a wrapper over [Microsoft Authentication Library for .NET (MSAL .NET)](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet) that supports various authentication methods.
8181

82-
_Using user credentials_:
82+
- User credentials:
8383

84-
```powershell
85-
$clientId = '<app_id>'
86-
$tenantId = '<tenant_id>'
87-
$authority = "https://login.microsoftonline.com/$tenantId/v2.0"
88-
$Scope = 'https://api.adu.microsoft.com/user_impersonation'
84+
```powershell
85+
$clientId = '<app_id>'
86+
$tenantId = '<tenant_id>'
87+
$authority = "https://login.microsoftonline.com/$tenantId/v2.0"
88+
$Scope = 'https://api.adu.microsoft.com/user_impersonation'
89+
90+
Get-MsalToken -ClientId $clientId -TenantId $tenantId -Authority $authority -Scopes $Scope
91+
```
8992

90-
Get-MsalToken -ClientId $clientId -TenantId $tenantId -Authority $authority -Scopes $Scope
91-
```
93+
- User credentials with device code:
9294

93-
_Using user credentials with device code_:
95+
```powershell
96+
$clientId = '<app_id>’
97+
$tenantId = '<tenant_id>’
98+
$authority = "https://login.microsoftonline.com/$tenantId/v2.0"
99+
$Scope = 'https://api.adu.microsoft.com/user_impersonation'
100+
101+
Get-MsalToken -ClientId $clientId -TenantId $tenantId -Authority $authority -Scopes $Scope -Interactive -DeviceCode
102+
```
94103

95-
```powershell
96-
$clientId = '<app_id>’
97-
$tenantId = '<tenant_id>’
98-
$authority = "https://login.microsoftonline.com/$tenantId/v2.0"
99-
$Scope = 'https://api.adu.microsoft.com/user_impersonation'
100-
101-
Get-MsalToken -ClientId $clientId -TenantId $tenantId -Authority $authority -Scopes $Scope -Interactive -DeviceCode
102-
```
104+
- App credentials:
103105

104-
_Using app credentials_:
105-
106-
```powershell
107-
$clientId = '<app_id>’
108-
$tenantId = '<tenant_id>’
109-
$cert = '<client_certificate>'
110-
$authority = "https://login.microsoftonline.com/$tenantId/v2.0"
111-
$Scope = 'https://api.adu.microsoft.com/.default'
112-
113-
Get-MsalToken -ClientId $clientId -TenantId $tenantId -Authority $authority -Scopes $Scope -ClientCertificate $cert
114-
```
106+
```powershell
107+
$clientId = '<app_id>’
108+
$tenantId = '<tenant_id>’
109+
$cert = '<client_certificate>'
110+
$authority = "https://login.microsoftonline.com/$tenantId/v2.0"
111+
$Scope = 'https://api.adu.microsoft.com/.default'
112+
113+
Get-MsalToken -ClientId $clientId -TenantId $tenantId -Authority $authority -Scopes $Scope -ClientCertificate $cert
114+
```
115115

116116
## Support for managed identities
117117

118-
Managed identities provide Azure services with an automatically managed identity in Microsoft Entra ID in a secure manner. This eliminates the needs for developers having to manage credentials by providing an identity. Device Update for IoT Hub supports system-assigned managed identities.
118+
Managed identities provide Azure services with secure, automatically managed Microsoft Entra ID identities. Managed identities eliminate the need for developers to manage credentials by providing identities. Device Update supports system-assigned managed identities.
119+
120+
To add a system-assigned managed identity for Device Update:
119121

120-
### System-assigned managed identity
122+
1. In the Azure portal, go to your Device Update account.
123+
1. In the left navigation, select **Settings** > **Identity**.
124+
1. Under **System assigned** on the **Identity** page, set **Status** to **On**.
125+
1. Select **Save**, and then select **Yes**.
121126

122-
To add and remove a system-assigned managed identity in Azure portal:
123-
1. Sign in to the Azure portal and navigate to your desired Device Update for IoT Hub account.
124-
2. Navigate to Identity in your Device Update for IoT Hub portal
125-
3. Navigate to Identity in your IoT Hub portal
126-
4. Under System-assigned tab, select On and click Save.
127+
To add a system-assigned managed identity for IoT Hub:
127128

128-
To remove system-assigned managed identity from a Device Update for IoT hub account, select Off and click Save.
129+
1. In the Azure portal, go to your IoT hub.
130+
1. In the left navigation, select **Security settings** > **Identity**.
131+
1. Under **System-assigned** on the **Identity** page, select **On** under **Status**.
132+
1. Select **Save**, and then select **Yes**.
129133

134+
To remove system-assigned managed identity from a Device Update account or IoT hub, set or select **Off** on the **Identity** page, and then select **Save**.
130135

136+
## Related content
131137

132-
## Next Steps
133-
* [Create device update resources and configure access control roles](./create-device-update-account.md)
138+
- [Create Azure Device Update for IoT Hub resources](create-device-update-account.md)
139+
- [Configure access control for Device Update resources](configure-access-control-device-update.md)

0 commit comments

Comments
 (0)