[AKS] az aks create: Update prom and logs addon to use sdk#31828
[AKS] az aks create: Update prom and logs addon to use sdk#31828
az aks create: Update prom and logs addon to use sdk#31828Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
There was a problem hiding this comment.
Pull Request Overview
This PR modernizes Azure Monitor metrics and logs addon code by replacing direct HTTP API calls (send_raw_request) with Azure SDK client methods. This improves code maintainability, type safety, and error handling consistency.
- Replaces
send_raw_requestcalls with Azure SDK resource client methods (begin_create_or_update_by_id,begin_delete_by_id, etc.) - Standardizes exception handling from
CLIErrorto genericExceptionwith consistent re-raising patterns - Converts JSON string bodies to Python dictionaries for SDK compatibility
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| delete.py | Replace raw DELETE requests with SDK delete methods for recording rules |
| create.py | Replace raw PUT requests with SDK create/update methods for recording rules |
| helper.py | Replace raw POST request with SDK provider registration |
| dc/delete.py | Replace raw requests with SDK methods for data collection object deletion |
| dcra_api.py | Replace raw PUT request with SDK method for data collection rule association |
| dcr_api.py | Replace raw PUT request with SDK method for data collection rule creation |
| dce_api.py | Replace raw PUT request with SDK method for data collection endpoint creation |
| amw/create.py | Replace raw PUT request with SDK method for Azure Monitor Workspace creation |
| amg/link.py | Replace raw requests with SDK methods for Grafana instance linking |
| addonput.py | Replace raw GET/PUT requests with managed cluster client methods |
| addonconfiguration.py | Replace multiple raw requests with SDK methods for container insights configuration |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
…s/amg/link.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
az aks create: Update prom and logs addon to use sdk
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az aks create: Update prom and logs addon to use sdkaz aks create: Update prom and logs addon to use sdk
|
/azp run |
|
Commenter does not have sufficient privileges for PR 31828 in repo Azure/azure-cli |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Queued live test to validate the change, one of 10 failed, re-queued test_aks_update_with_azuremonitormetrics, test passed!
- test_aks_create_with_azuremonitormetrics
- test_aks_update_with_azuremonitormetrics
- test_aks_create_with_monitoring_aad_auth_msi
- test_aks_create_with_monitoring_aad_auth_msi_with_syslog
- test_aks_create_with_monitoring_aad_auth_msi_with_datacollectionsettings
- test_aks_create_with_monitoring_aad_auth_msi_with_datacollectionsettings_and_otheraddon
- test_aks_create_with_private_cluster_with_monitoring_aad_auth_msi_with_ampls
- test_aks_create_with_monitoring_aad_auth_with_highlogscale
- test_aks_enable_monitoring_with_aad_auth_uai_with_syslog
- test_aks_enable_monitoring_with_aad_auth_uai
Related command
az aks enable-addons -a monitoringand related Azure Monitor logs addon commandsaz aks create/update --enable-azure-monitor-metricsand related Azure Monitor metrics commandsDescription
This PR modernizes Azure Monitor metrics and logs addon code by replacing direct HTTP API calls (
send_raw_request) with Azure SDK client methods. This improves code maintainability, type safety, and error handling consistency.Testing Guide
Test the Azure Monitor metrics and logs addon functionality:
History Notes
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.