Repository navigation
[connectedvmware] Fix cross-subscription VM onboarding - #10373
aaronngo-microsoft wants to merge 10 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Hi aaronngo-microsoft, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution aaronngo-microsoft! We will review the pull request and get back to you soon. |
|
connectedvmware |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes are focused, correctly scoped, and covered by unit and live-test paths.
Review effort: Lite
Findings: None
What changed in this PR
Fixes create-from-machines for machines and vCenters in different subscriptions.
Changes:
- Scopes Resource Graph queries to both subscriptions while filtering machines to the active subscription.
- Adds unit and live cross-subscription coverage.
- Updates help examples, changelog, and extension version.
| File | Description |
|---|---|
src/connectedvmware/setup.py |
Bumps version to 1.2.2 |
src/connectedvmware/HISTORY.rst |
Documents the fix |
src/connectedvmware/azext_connectedvmware/custom.py |
Implements cross-subscription query handling |
src/connectedvmware/azext_connectedvmware/_help.py |
Adds subscription examples |
src/connectedvmware/azext_connectedvmware/tests/latest/test_custom.py |
Adds deterministic unit coverage |
src/connectedvmware/azext_connectedvmware/tests/latest/test_connectedvmware_scenario.py |
Adds live scenario coverage |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| logger.debug("Querying subscriptions: %s", query_subscriptions) | ||
| query_request = QueryRequest( | ||
| subscriptions=[get_subscription_id(cmd.cli_ctx)], | ||
| subscriptions=query_subscriptions, |
There was a problem hiding this comment.
We need to test that the subscription provided in the input parameter to the CLI command is considered in the query here
There was a problem hiding this comment.
If I'm reading the logic correctly, we include the subscriptions
- subscription user got in az cli
- subscription of the vCenter id
but what about the subscription id provided as an CLI arg https://learn.microsoft.com/en-us/azure/azure-arc/vmware-vsphere/enable-virtual-hardware#link-arc-enabled-server-machines-to-vcenter-using-azure-cli
e.g. contoso-sub
az connectedvmware vm create-from-machines --subscription contoso-sub --vcenter-id /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/allhands-demo/providers/microsoft.connectedvmwarevsphere/VCenters/ContosovCentervcenters/contoso-vcenter
There was a problem hiding this comment.
apparently the subscription set for the list is az cli if no --subscription flag is provided. if --subscription is provided then we will use that subscription
There was a problem hiding this comment.
first i login into hybrid compute sub, then i supplied the vcenter sub as well as the the subscription where i created my VM, then the result in the recording will be the subscriptions of the vm and the vcenter
Isolate playback cloud and subscription state and preserve distinct subscription identities in recordings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az connectedvmware vm create-from-machinesSummary
Fix
create-from-machineswhen the Hybrid Compute machine and vCenter inventory are in different subscriptions.--subscriptioncontext as the machine subscription.connectedvmwareto version1.2.2and updateHISTORY.rst.Testing
python -m unittest azext_connectedvmware.tests.latest.test_custom azext_connectedvmware.vmware_utils_test— 14 tests passed.AZURE_CONNECTEDVMWARE_TEST_*environment variables.General Guidelines
azdev style connectedvmwarelocally? (azdevis not configured in this environment; targeted Flake8 checks passed.)python scripts/ci/test_index.py -qlocally? (src/index.jsonis unchanged.)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once this pull request is merged into main, a new pull request will update
src/index.jsonautomatically.This pull request updates
setup.pyandHISTORY.rstand does not modifysrc/index.json.