Skip to content

{AKS} Specify principal type in live-test role assignment - #33998

Open
FumingZhang wants to merge 1 commit into
Azure:devfrom
FumingZhang:aks/pim-role-assignment-principal-type
Open

{AKS} Specify principal type in live-test role assignment#33998
FumingZhang wants to merge 1 commit into
Azure:devfrom
FumingZhang:aks/pim-role-assignment-principal-type

Conversation

@FumingZhang

@FumingZhang FumingZhang commented Aug 27, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command
az role assignment create in test_aks_create_with_outbound_type_udr

Description
PIM Only Mode requires persistent role-assignment requests for service principals and managed identities to include principalType explicitly.

When the AKS live-test service principal object ID is available, create the Network Contributor assignment with --assignee-object-id and --assignee-principal-type ServicePrincipal. This avoids relying on Microsoft Graph to infer the principal type. The explicit conditional also preserves the complete role-assignment command in the fallback path.

This is a test-only compliance hardening change; it does not change customer-facing AKS command behavior.

Testing Guide

  • flake8 --append-config=.flake8 src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py
  • python -m pylint --rcfile=pylintrc src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py
  • python -m py_compile src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py

The live scenario was not run because it provisions an AKS cluster, Azure Firewall, networking resources, and RBAC assignments.

History Notes
None. This change only updates live-test setup.


Use the test service principal object ID with an explicit ServicePrincipal type so PIM Only Mode can evaluate the role assignment without relying on Microsoft Graph inference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the AKS live test setup for test_aks_create_with_outbound_type_udr to create a Network Contributor role assignment without relying on Microsoft Graph principal type inference, aligning the test with PIM Only Mode requirements.

Changes:

  • When the test service principal object ID is available, creates the role assignment using --assignee-object-id plus explicit --assignee-principal-type ServicePrincipal.
  • Preserves the existing fallback behavior using --assignee {service_principal} when the object ID is unavailable.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@yonzhan

Copy link
Copy Markdown
Collaborator

AKS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants