Skip to content

Disambiguate default legacy resource names - #5247

Draft
Dapeng Zhang (ArcturusZhang) wants to merge 2 commits into
Azure:mainfrom
ArcturusZhang:arcturusz/repro-compute-runcommand-resources
Draft

Disambiguate default legacy resource names#5247
Dapeng Zhang (ArcturusZhang) wants to merge 2 commits into
Azure:mainfrom
ArcturusZhang:arcturusz/repro-compute-runcommand-resources

Conversation

@ArcturusZhang

@ArcturusZhang Dapeng Zhang (ArcturusZhang) commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #5251 by disambiguating implicit default legacy resource names only when distinct resolved resources would otherwise collide.

The Compute run-command case now keeps distinct names for both preserved resource identities:

  • Microsoft.Compute/virtualMachines/runCommands -> VirtualMachinesRunCommands
  • Microsoft.Compute/virtualMachineScaleSets/virtualMachines/runCommands -> VirtualMachineScaleSetsVirtualMachinesRunCommands

Explicit resource names are preserved. Non-colliding default names keep existing behavior.

Validation

  • pnpm exec prettier --write packages/typespec-azure-resource-manager/src/resource.ts packages/typespec-azure-resource-manager/test/resource-resolution.test.ts
  • pnpm exec vitest run test/resource-resolution.test.ts
  • pnpm --filter @azure-tools/typespec-azure-resource-manager lint

Cover the Compute pattern where VirtualMachineRunCommand is reused across virtual machine and VMSS VM parent paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 10e564a2-4523-48ae-821e-a1c3e878765f
@microsoft-github-policy-service microsoft-github-policy-service Bot added the lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library label Aug 18, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@azure-tools/typespec-azure-resource-manager@5247

commit: c05c14f

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @azure-tools/typespec-azure-resource-manager
Show changes

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

📦 Package size report

1 package changed size, +1.33 KB (+0.0%) packed overall.

Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-azure-resource-manager 171.92 KB → 173.20 KB +1.28 KB (+0.7%) 🔴 1.04 MB → 1.05 MB +7.12 KB (+0.7%) 🔴
12 package(s) with no notable change
Package Packed (base → head) Δ Packed Unpacked (base → head) Δ Unpacked
@azure-tools/typespec-java 13.51 MB → 13.51 MB +49 B (+0.0%) 15.03 MB → 15.03 MB
@azure-tools/azure-http-specs 146.63 KB → 146.63 KB 1.16 MB → 1.16 MB
@azure-tools/typespec-autorest 80.93 KB → 80.93 KB 395.06 KB → 395.06 KB
@azure-tools/typespec-autorest-canonical 7.42 KB → 7.42 KB 26.00 KB → 26.00 KB
@azure-tools/typespec-azure-core 129.43 KB → 129.43 KB 702.77 KB → 702.77 KB
@azure-tools/typespec-azure-portal-core 42.40 KB → 42.40 KB 192.91 KB → 192.91 KB
@azure-tools/typespec-azure-rulesets 5.16 KB → 5.16 KB 32.09 KB → 32.09 KB
@azure-tools/typespec-client-generator-core 226.69 KB → 226.69 KB 1.22 MB → 1.22 MB
@azure-tools/typespec-go 250.58 KB → 250.58 KB 1.28 MB → 1.28 MB
@azure-tools/typespec-metadata 15.91 KB → 15.91 KB 62.26 KB → 62.26 KB
@azure-tools/typespec-python 42.20 KB → 42.20 KB 164.85 KB → 164.85 KB
@azure-tools/typespec-ts 527.17 KB → 527.17 KB 2.54 MB → 2.54 MB

Packed = gzipped .tgz published to npm. Unpacked = total extracted size. 🆕 added, 🗑️ removed. Packages from the core/ submodule are not included.
🔴 grew · 🟢 shrank — only changes of at least 512 B and 0.5% are marked.

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

You can try these changes here

🛝 Playground 🌐 Website

Avoid duplicate default resource names when distinct legacy resource identities share the same last two resource type segments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 10e564a2-4523-48ae-821e-a1c3e878765f
@ArcturusZhang Dapeng Zhang (ArcturusZhang) changed the title Add Compute run command resource resolution test Disambiguate default legacy resource names Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resolveArmResources default legacy resource names can collide for nested resources

1 participant