Skip to content

Commit bd788da

Browse files
authored
Merge pull request #292964 from troy0820/troy0820/create-cluster-with-uami
[operator-nexus] Create cluster with user-assigned managed identity
2 parents e9c727d + f035a24 commit bd788da

File tree

3 files changed

+116
-1
lines changed

3 files changed

+116
-1
lines changed

articles/operator-nexus/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@
147147
href: howto-configure-network-fabric.md
148148
- name: Cluster
149149
href: howto-configure-cluster.md
150+
- name: Cluster Creation With Managed Identity
151+
href: howto-create-cluster-with-user-assigned-managed-identity.md
150152
- name: Cluster Template JSON Example
151153
href: cluster-jsonc-example.md
152154
- name: Cluster Parameters JSON Example
@@ -429,4 +431,4 @@
429431
expanded: false
430432
items:
431433
- name: 2404.2
432-
href: release-notes-2404.2.md
434+
href: release-notes-2404.2.md

articles/operator-nexus/howto-configure-cluster.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Managed Identity can be assigned to the Cluster during creation or update operat
118118
- **--mi-system-assigned** - Enable System-assigned managed identity. Once added, the Identity can only be removed via the API call at this time.
119119
- **--mi-user-assigned** - Space-separated resource IDs of the User-assigned managed identities to be added. Once added, the Identity can only be removed via the API call at this time.
120120

121+
[Create cluster with User assigned Managed Identity](./howto-create-cluster-with-user-assigned-managed-identity.md)
121122
### Create the Cluster using Azure Resource Manager template editor
122123

123124
An alternate way to create a Cluster is with the ARM template editor.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: "Azure Operator Nexus: Create Cluster Resource with a Managed Identity"
3+
description: Create Clusters using the User Assigned Managed Identity to access the Log Analytics Workspace.
4+
author: troy0820
5+
ms.author: troyconnor
6+
ms.service: azure-operator-nexus
7+
ms.topic: how-to
8+
ms.date: 01/08/2025
9+
ms.custom: template-how-to
10+
---
11+
12+
13+
# Create a Cluster Resource with a Managed Identity
14+
15+
To create a cluster without a service principal user name and password, you can now create a cluster with a user-assigned managed identity or a system-assigned managed identity that has permissions over the Log Analytics Workspace. This will be used when validating the hardware during hardware validation and when installing the extensions that utilize the Log Analytics Workspace.
16+
17+
## Prerequisites
18+
19+
* Install the latest version of the
20+
[appropriate CLI extensions](./howto-install-cli-extensions.md)
21+
* A Log Analytics Workspace
22+
* A user-assigned managed identity resource with permissions over the log analytics workspace of [Log Analytics Contributor](/azure/role-based-access-control/built-in-roles/analytics#log-analytics-contributor).
23+
24+
> [!NOTE]
25+
> This functionality exists with the 2024-10-01-preview API and will be available with the 2025-02-01 GA API offered by Azure Operator Nexus
26+
27+
28+
### Create and configure Log Analytics Workspace and User Assigned Managed Identity
29+
30+
1. Create a Log Analytics Workspace [Create a Log Analytics Workspace](/azure/azure-monitor/logs/quick-create-workspace).
31+
1. Assign the "Log Analytics Contributor" role to users and managed identities which need access to the Log Analytics Workspace.
32+
1. See [Assign an Azure role for access to the analytics Workspace](/azure/azure-monitor/logs/manage-access?tabs=portal#azure-rbac). The role must also be assigned to either a user-assigned managed identity or the cluster's own system-assigned managed identity.
33+
1. For more information on managed identities, see [Managed identities for Azure resources](/entra/identity/managed-identities-azure-resources/overview).
34+
1. If using the Cluster's system assigned identity, the system assigned identity needs to be added to the cluster before it can be granted access.
35+
1. When assigning a role to the cluster's system-assigned identity, make sure you select the resource with the type "Cluster (Operator Nexus)."
36+
37+
### Configure the cluster to use a user-assigned managed identity for Log Analytics Workspace access
38+
39+
```azurecli-interactive
40+
az networkcloud cluster create --name "<cluster-name>" \
41+
--resource-group "<cluster-resource-group>" \
42+
--mi-user-assigned "<user-assigned-identity-resource-id>" \
43+
--analytics-output-settings identity-type="UserAssignedIdentity" \
44+
identity-resource-id="<user-assigned-identity-resource-id>" \
45+
...
46+
--subscription "<subscription>"
47+
```
48+
49+
### View the principal ID for the user-assigned managed identity
50+
51+
The identity resource ID can be found by selecting "JSON view" on the identity resource; the ID is at the top of the panel that appears. The container URL can be found on the Settings -> Properties tab of the container resource.
52+
53+
The CLI can also be used to view the identity and the associated principal ID data within the cluster.
54+
55+
Example:
56+
57+
```console
58+
az networkcloud cluster show --ids /subscriptions/<Subscription ID>/resourceGroups/<Cluster Resource Group Name>/providers/Microsoft.NetworkCloud/clusters/<Cluster Name>
59+
```
60+
61+
User-assigned identity example:
62+
63+
```json
64+
"identity": {
65+
"type": "UserAssigned",
66+
"userAssignedIdentities": {
67+
"/subscriptions/<subscriptionID>/resourcegroups/<resourceGroupName>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<userAssignedIdentityName>": {
68+
"clientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
69+
"principalId": "bbbbbbbb-cccc-dddd-2222-333333333333"
70+
}
71+
}
72+
},
73+
```
74+
75+
### Create and configure Log Analytics Workspace and System Assigned Managed Identity
76+
77+
> [!NOTE]
78+
> The system-assigned managed identity that is created during cluster creation does not exist until the cluster is created. This system-assigned managed identity will need to have permissions over the scope of the Log Analytics Workspace with the role of Log Analytics Contributor before we can update the cluster to utilize this identity. This update must occur before the Cluster can be deployed.
79+
80+
```azurecli-interactive
81+
az networkcloud cluster update --name "<cluster-name>" \
82+
--resource-group "<cluster-resource-group>" \
83+
--mi-system-assigned "<system-assigned-identity-resource-id>" \
84+
--analytics-output-settings identity-type="SystemAssignedIdentity" \
85+
identity-resource-id="<user-assigned-identity-resource-id>" \
86+
...
87+
--subscription "<subscription>"
88+
```
89+
90+
### View the principal ID for the system-assigned managed identity
91+
92+
The identity resource ID can be found by selecting "JSON view" on the identity resource; the ID is at the top of the panel that appears. The container URL can be found on the Settings -> Properties tab of the container resource.
93+
94+
The CLI can also be used to view the identity and the associated principal ID data within the cluster.
95+
96+
Example:
97+
98+
```console
99+
az networkcloud cluster show --ids /subscriptions/<Subscription ID>/resourceGroups/<Cluster Resource Group Name>/providers/Microsoft.NetworkCloud/clusters/<Cluster Name>
100+
```
101+
102+
System-assigned identity example:
103+
104+
```json
105+
"identity": {
106+
"principalId": "aaaaaaaa-bbbb-cccc-1111-222222222222",
107+
"tenantId": "aaaabbbb-0000-cccc-1111-dddd2222eeee",
108+
"type": "SystemAssigned"
109+
},
110+
```
111+
112+

0 commit comments

Comments
 (0)