Conversation
…-id and --skip-endpoint-discovery
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| cloud register | cmd cloud register added parameter endpoint_microsoft_graph_resource_id |
||
| cloud register | cmd cloud register added parameter skip_endpoint_discovery |
||
| cloud update | cmd cloud update added parameter endpoint_microsoft_graph_resource_id |
||
| cloud update | cmd cloud update added parameter skip_endpoint_discovery |
|
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>
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the az cloud register and az cloud update commands by adding two new options:
--endpoint-microsoft-graph-resource-idto configure the Microsoft Graph endpoint--skip-endpoint-discoveryto bypass automatic endpoint discovery when metadata fetches fail
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test_cloud.py | Added a scenario to verify that --skip-endpoint-discovery skips discovery and preserves resourceManager. |
| custom.py | Updated _build_cloud, register_cloud, and modify_cloud to accept the new flags and wire them through. |
| init.py | Exposed the new CLI arguments skip_endpoint_discovery and endpoint_microsoft_graph_resource_id. |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/cloud/tests/latest/test_cloud.py:105
- Add a test case for the new
--endpoint-microsoft-graph-resource-idflag (e.g., update with--endpoint-microsoft-graph-resource-id https://graph.example.comand assert thatendpoints.microsoft_graph_resource_idis set).
# Skip cloud discovery
|
|
||
|
|
||
| def _build_cloud(cli_ctx, cloud_name, cloud_config=None, cloud_args=None): | ||
| def _build_cloud(cli_ctx, cloud_name, skip_endpoint_discovery=False, cloud_config=None, cloud_args=None): |
There was a problem hiding this comment.
[nitpick] The skip-discovery branch duplicates parts of the cloud construction logic. Consider refactoring so common setup (e.g., setting c.name, c.profile, and applying cloud_args) is shared, reducing code duplication.
| c = _build_cloud(cmd.cli_ctx, cloud_name, cloud_config=cloud_config, | ||
| cloud_args=locals()) | ||
| c = _build_cloud(cmd.cli_ctx, cloud_name, skip_endpoint_discovery=skip_endpoint_discovery, | ||
| cloud_config=cloud_config, cloud_args=locals()) |
There was a problem hiding this comment.
Using locals() is very hacky and unpredictable. It may end up with unwanted variables being recorded in the cloud.
There was a problem hiding this comment.
it's an old implementation which is unrelated with my changes. So I didn't modify it
There was a problem hiding this comment.
I know. Technical debt, not necessary to address right now.
|
Nitpicking: This PR contains 2 independent features. Creating a PR for each feature is a better practice. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az cloud register/updateDescription
This PR does two things:
--endpoint-microsoft-graph-resource-idto allow configuring Microsoft Graph endpoint as AD Graph should already be deprecated, so that we can closeaz cloud registershould support configuring Microsoft Graph endpoint #20846--skip-endpoint-discoveryto allow skipping the endpoint discovery process when there're errors during calling$endpointResourceManager/metadata/endpoints?api-version=2022-09-01, so that we can workaround Error when registering Azure Stack Hub #31547Testing Guide
History Notes
[Cloud]
az cloud register/update: Add--endpoint-microsoft-graph-resource-idto support configuring Microsoft Graph endpoint[Cloud]
az cloud register/update: Add--skip-endpoint-discoveryto allow skipping cloud endpoints' auto discoveryThis 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.