Skip to content

[AKS] Use AAD auth by default for AKS addons#29422

Merged
VeryEarly merged 2 commits intomainfrom
nori/aks-useAADAuth
Apr 22, 2026
Merged

[AKS] Use AAD auth by default for AKS addons#29422
VeryEarly merged 2 commits intomainfrom
nori/aks-useAADAuth

Conversation

@NoriZC
Copy link
Copy Markdown
Contributor

@NoriZC NoriZC commented Apr 20, 2026

Description

Fixing #29421

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings April 20, 2026 04:30
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 module’s Monitoring add-on enablement flow so that the resulting omsagent add-on profile opts into AAD-based authentication by default, aligning with newer Azure Monitor agent requirements.

Changes:

  • Set useAADAuth=true in the Monitoring (omsagent) add-on configuration when enabling Monitoring.
  • Added an Az.Aks changelog entry describing the behavior change.
  • Updated AKS scenario test to validate useAADAuth is present in the returned add-on config.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Aks/Aks/Utils/AddonUtils.cs Adds useAADAuth to the Monitoring add-on config map.
src/Aks/Aks/ChangeLog.md Documents the default useAADAuth=true behavior for Monitoring enablement.
src/Aks/Aks.Test/ScenarioTests/KubernetesTests.ps1 Adjusts cluster creation and asserts useAADAuth is set for omsagent.

Comment thread src/Aks/Aks/ChangeLog.md
Comment on lines +21 to +22
* Set `useAADAuth` to `true` by default in the omsagent addon profile when enabling the Monitoring addon via `Enable-AzAksAddOn` and `New-AzAksCluster`
- This ensures compatibility with the latest Azure Monitor agent which requires AAD authentication
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Changelog entry uses the acronym "AAD" without expanding it. In ChangeLog.md entries, less-obvious acronyms should be explained on first use (e.g., "AAD (Azure Active Directory)") and the entry should focus on user impact (for example, clarifying how enabling the Monitoring add-on behavior changes for users).

Suggested change
* Set `useAADAuth` to `true` by default in the omsagent addon profile when enabling the Monitoring addon via `Enable-AzAksAddOn` and `New-AzAksCluster`
- This ensures compatibility with the latest Azure Monitor agent which requires AAD authentication
* Updated the Monitoring addon behavior in `Enable-AzAksAddOn` and `New-AzAksCluster` to set `useAADAuth` to `true` by default in the omsagent addon profile
- When you enable the Monitoring addon, Azure Active Directory authentication is now enabled by default for compatibility with the latest Azure Monitor agent

Copilot uses AI. Check for mistakes.
New-AzResourceGroup -Name $resourceGroupName -Location 'eastus'

$cluster = New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize
$cluster = New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -NodeVmSize $nodeVmSize -GenerateSshKey
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Using -GenerateSshKey in this scenario test can make the test flaky and can have side effects on the build agent: New-AzAksCluster -GenerateSshKey writes to {HOME}/.ssh/id_rsa and throws if that file already exists. Prefer passing -SshKeyValue from a test-generated temporary key (or reusing an existing test key) so the test doesn’t depend on or modify the agent’s user profile.

Copilot uses AI. Check for mistakes.
Assert-AreEqual $false $cluster.AddonProfiles['azurepolicy'].Enabled

$cluster2 = New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName2 -NodeVmSize $nodeVmSize
$cluster2 = New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName2 -NodeVmSize $nodeVmSize -GenerateSshKey
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Using -GenerateSshKey in this scenario test can make the test flaky and can have side effects on the build agent: New-AzAksCluster -GenerateSshKey writes to {HOME}/.ssh/id_rsa and throws if that file already exists. Prefer passing -SshKeyValue from a test-generated temporary key (or reusing an existing test key) so the test doesn’t depend on or modify the agent’s user profile.

Copilot uses AI. Check for mistakes.
@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @act-observability-squad.

@NoriZC NoriZC assigned VeryEarly and unassigned NoriZC Apr 22, 2026
@VeryEarly VeryEarly merged commit 405f8f1 into main Apr 22, 2026
12 checks passed
@VeryEarly VeryEarly deleted the nori/aks-useAADAuth branch April 22, 2026 07:38
@NoriZC NoriZC added this to the Az 15.6.0 (05/05/2026) milestone Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants