Skip to content

Commit 54307d2

Browse files
update
1 parent 735393d commit 54307d2

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/fleet/azext_fleet/_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ def assign_network_contributor_role_to_subnet(cmd, object_id, subnet_id):
161161
logger.warning("Failed to create Network Contributor role assignment on the subnet %s.\n"
162162
"This role assignment is required for the managed identity to access the subnet.\n"
163163
"Please ensure you have sufficient permissions, or ask an administrator to run:\n"
164-
"az role assignment create --assignee %s --role 'Network Contributor' --scope %s",
164+
"az role assignment create --assignee-principal-type ServicePrincipal --assignee-object-id %s "
165+
"--role 'Network Contributor' --scope %s",
165166
subnet_id, object_id, subnet_id)
166167

167168

src/fleet/azext_fleet/_validators.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ def validate_assign_identity(namespace):
6161

6262

6363
def validate_enable_vnet_integration(namespace):
64-
if namespace.enable_vnet_integration and not namespace.enable_managed_identity:
65-
raise CLIError("--enable-vnet-integration requires managed identity to be enabled. "
66-
"Please add --enable-managed-identity to your command.")
64+
if namespace.enable_vnet_integration:
65+
if not namespace.enable_managed_identity or namespace.assign_identity is None:
66+
raise CLIError("--enable-vnet-integration requires user assigned managed identity to be enabled. "
67+
"Please add --enable-managed-identity and --assign-identity <identity-id> to your command.")
6768

6869

6970
def validate_targets(namespace):

0 commit comments

Comments
 (0)