[ARM] az ts: Capture subscription id from template resource id#31896
[ARM] az ts: Capture subscription id from template resource id#31896
az ts: Capture subscription id from template resource id#31896Conversation
Update template spec operations to extract and use the subscription ID from the resource ID if provided. Add tests to verify correct handling of subscription IDs in show, update, delete, and export commands for template specs.
Deleted test cases and YAML recordings related to template spec operations using a fake subscription ID. These tests were unnecessary as the functionality is already tested in other tests.
Removed redundant subscription_id variable assignments in template spec-related functions. Now, subscription_id is passed directly from parsed resource ID when template_spec is provided, improving code clarity and reducing duplication.
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
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>
|
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the az ts (template spec) commands to dynamically extract and use the subscription ID from the template spec resource ID when provided. This eliminates the need for users to explicitly specify the subscription parameter when working with template specs from different subscriptions.
- Updates the template spec client factory to accept an optional subscription_id parameter
- Modifies show, update, delete, and export commands to parse subscription ID from template spec resource ID
- Improves user experience by automatically setting the correct subscription context
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
_client_factory.py |
Adds optional subscription_id parameter to template spec client factory |
custom.py |
Updates template spec commands to extract subscription ID from resource ID and pass to client factory |
|
Could you please add or update relevant test cases to ensure the changes work correctly in our test tenant? |
Thank you @ReaNAiveD for the review! Regarding test cases, I had initially added one for each sub-command but have noticed that my changes are already tested withing the current show, update, export and delete tests for the template specs. Example: |
Aditya explains the reason offline. |
|
Since this pr add the ability to omit the |
|
useful snniepts for cross-sub testing: |
az ts: Capture subscription id from template resource idaz ts: Capture subscription id from template resource id
Introduces new test cases to validate update, show, delete and export operations for template specs using an auxiliary subscription.
Related command
ts
Description
Testing Guide
Can be tested using:
az ts show -s {template-spec-id} ...az ts update -s {template-spec-id} ...az ts delete -s {template-spec-id} ...az ts export -s {template-spec-id} ...Current tests already assess this functionality
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.