Skip to content

[Network] az network authentication-policy: Support authentication policy commands - #34447

Merged
Ethan Yang (necusjz) merged 1 commit into
Azure:devfrom
huiii99:network-feat-34269
Nov 23, 2026
Merged

Ethan Yang (necusjz) merged 1 commit into
Azure:devfrom
huiii99:network-feat-34269

Conversation

@huiii99

@huiii99 Jian Hui (huiii99) commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
⚠️ None ️✔️ 130/130 ️✔️ None
⚠️AzureCLI-BreakingChangeTest
⚠️network
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd network authentication-policy sub group network authentication-policy added

Related command
az network authentication-policy create/update/delete/show/list/wait
az network authentication-policy identity assign/remove/show/wait

Description
Resolve #34269
AAZ: Azure/aaz#1171

Add the new az network authentication-policy command group for the Microsoft.Network/authenticationPolicies resource (API version 2026-01-01). It has CRUD, list (resource group and subscription), wait, and user-assigned identity management commands. An authentication policy can be bound to Application Gateway basic routing rules, the advanced routing map default, and advanced routing map rules through the existing --auth-configs / --default-auth-configs arguments.

Testing Guide

# JWT validation policy
az network authentication-policy create -g MyRG -n MyJwtPolicy \
  --auth-props "{jwt-validation-properties:{issuer-url:'https://login.microsoftonline.com/{tenant}/v2.0',audiences:[api://myapp]}}" \
  --on-unauth-req deny

# User sign-in policy with a user-assigned identity
az network authentication-policy create -g MyRG -n MySignInPolicy --mi-user-assigned $identityId \
  --auth-props "{user-sign-in-properties:{client-id:$clientId,client-secret:$secretUri,issuer-url:'https://login.microsoftonline.com/{tenant}/v2.0',scope:[openid,profile]}}"

# Bind to a basic routing rule
az network application-gateway rule update -g MyRG --gateway-name MyAG -n rule2 \
  --auth-configs "[{authentication-policy:{id:$policyId}}]"

# Bind to the advanced routing map default and a map rule
az network application-gateway advanced-routing-map update -g MyRG --gateway-name MyAG -n map1 \
  --default-auth-configs "[{authentication-policy:{id:$policyId}}]"
az network application-gateway advanced-routing-map rule update -g MyRG --gateway-name MyAG --map-name map1 -n rule1 \
  --auth-configs "[{authentication-policy:{id:$policyId}}]"

Scenario tests (recorded live, then replayed):

  • test_network_authentication_policy: create/update/show/list/wait/delete, identity assign/show/remove.
  • test_network_ag_authentication_policy: binds JWT and sign-in policies to a basic routing rule, the advanced routing map default and map rules; checks that deleting a policy in use fails; unbinds the policies with null; then deletes them.
azdev test test_network_authentication_policy test_network_ag_authentication_policy  # passed
azdev linter network  # passed

History Notes
[Network] az network authentication-policy: Add command group to support authentication policy


This checklist is used to make sure that common guidelines for a pull request are followed.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Hi Jian Hui (@huiii99),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@huiii99 Jian Hui (huiii99) changed the title [Network] az network authentication-policy: Add new command group to support authentication policy [Network] az network authentication-policy: Support authentication policy commands Nov 19, 2026
@huiii99
Jian Hui (huiii99) marked this pull request as ready for review November 19, 2026 05:16
Copilot AI balanced review requested due to automatic review settings November 19, 2026 05:16

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.

🟡 Changes recommended

Identity removal matches ARM IDs case-sensitively, so casing-only differences can silently leave an identity assigned while reporting success.

1 open issue
What changed in this PR

Adds az network authentication-policy to manage Application Gateway authentication policies, addressing #34269 with API version 2026-01-01.

Changes:

  • Adds policy create, update, delete, show, list, and wait commands.
  • Adds user-assigned managed identity assignment, removal, inspection, and wait commands.
  • Adds scenarios covering policy lifecycle and binding policies to basic and advanced Application Gateway routing rules.

Paths below are relative to src/azure-cli/azure/cli/command_modules/network/.

File Description
tests/​latest/​test_network_commands.py Adds lifecycle, identity, and gateway-binding scenarios.
aaz/​latest/​network/​authentication_policy/​identity/​_wait.py Waits for policy provisioning conditions after identity changes.
aaz/​latest/​network/​authentication_policy/​identity/​_show.py Displays policy managed identities.
aaz/​latest/​network/​authentication_policy/​identity/​_remove.py Removes user-assigned identities.
aaz/​latest/​network/​authentication_policy/​identity/​_assign.py Assigns user-assigned identities.
aaz/​latest/​network/​authentication_policy/​identity/​__init__.py Exports identity commands.
aaz/​latest/​network/​authentication_policy/​identity/​__cmd_group.py Registers the identity command subgroup.
aaz/​latest/​network/​authentication_policy/​_wait.py Waits for policy resource conditions.
aaz/​latest/​network/​authentication_policy/​_update.py Updates policy properties and supports generic updates.
aaz/​latest/​network/​authentication_policy/​_show.py Retrieves a policy.
aaz/​latest/​network/​authentication_policy/​_list.py Lists policies by resource group or subscription with pagination.
aaz/​latest/​network/​authentication_policy/​_delete.py Deletes policies with confirmation and asynchronous support.
aaz/​latest/​network/​authentication_policy/​_create.py Creates policies with authentication settings and optional identities.
aaz/​latest/​network/​authentication_policy/​__init__.py Exports policy commands.
aaz/​latest/​network/​authentication_policy/​__cmd_group.py Registers the authentication-policy command group.

Review effort: Balanced

value=instance,
typ=AAZIdentityObjectType
)
_builder.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "remove"}})
@necusjz
Ethan Yang (necusjz) merged commit acb2393 into Azure:dev Nov 23, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-quality-productivity-squad Network az network vnet/lb/nic/dns/etc...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding support for authentication policy resource

6 participants