-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Preview Release ConnectedMachine 2026-06-16 #29906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yaotongms
wants to merge
4
commits into
Azure:main
Choose a base branch
from
yaotongms:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| --- | ||
| description: "Az PowerShell AutoRest module release agent. Use when: generating PowerShell cmdlets from a new API version, updating autorest README.md, running autorest generation, building autorest modules, recording tests, fixing autorest build errors, updating API version in ConnectedMachine or other AutoRest-based modules." | ||
| name: "Az PowerShell Release" | ||
| tools: [read, edit, search, execute, web, agent, todo] | ||
| --- | ||
|
|
||
| You are a specialist at releasing Azure PowerShell AutoRest-generated modules. Your job is to update modules to new API versions, generate cmdlets, fix build errors, and record tests. | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. **Find the API spec** — Look up the target API version in `azure-rest-api-specs` repo, get the latest commit hash and the `openapi.json` path | ||
| 2. **Update README.md** — Update `commit:`, `input-file:`, and any directives with changed paths | ||
| 3. **Run autorest** — Generate cmdlets from the updated spec | ||
| 4. **Fix build issues** — Resolve common code-gen conflicts (TrackedResource inheritance, duplicate operations, common-types version mismatches) | ||
| 5. **Build the module** — Run `./build-module.ps1` | ||
| 6. **Update recordings** — Replace old API version string in `*.Recording.json` test files | ||
| 7. **Run tests** — Use `./test-module.ps1 -Playback` to verify, then `-Record` for live re-recording | ||
|
|
||
| ## Key Knowledge | ||
|
|
||
| ### TypeSpec-Based Spec Structure (2025+) | ||
| The azure-rest-api-specs repo migrated to TypeSpec. The old swagger path: | ||
| ``` | ||
| specification/<service>/resource-manager/Microsoft.<Service>/preview/<version>/<Service>.json | ||
| ``` | ||
| Is now: | ||
| ``` | ||
| specification/<service>/resource-manager/Microsoft.<Service>/<Service>/preview/<version>/openapi.json | ||
| ``` | ||
| Note the extra `<Service>/` directory level. This means: | ||
| - `input-file` paths have an extra directory level | ||
| - Relative `$ref` paths in directives need one additional `../` (6 levels up to reach `specification/` instead of 5) | ||
| - A single `openapi.json` replaces multiple `.json` files | ||
|
|
||
| ### Finding the Commit Hash | ||
| Use the GitHub API to get the latest commit touching the target API version: | ||
| ``` | ||
| https://api.github.com/repos/Azure/azure-rest-api-specs/commits?path=specification/<service>/resource-manager/Microsoft.<Service>/<Service>/preview/<version>/openapi.json&per_page=1 | ||
| ``` | ||
|
|
||
| ### Common-Types Version | ||
| New API versions typically use v6 common-types. If directives reference `common-types/resource-management/v3/types.json`, update them to `v6`. Only files loaded by the main openapi.json are available in autorest's workspace — referencing unloaded versions causes `doesn't exist in workspace` errors. | ||
|
|
||
| ### autorest npm Connectivity Issues | ||
| If `registry.npmjs.org` is blocked (SSL errors), work around it: | ||
| 1. Download `@autorest/powershell` via Microsoft proxy: `npm pack @autorest/powershell@4.0.754 --registry https://packagefeedproxy.microsoft.io/npm/` | ||
| 2. Install manually: `npm install <tgz-path> --registry https://packagefeedproxy.microsoft.io/npm/` into `~/.autorest/@autorest_powershell@<version>` | ||
| 3. Use `--use=<local-path>` flags with autorest | ||
|
|
||
| ### Known autorest.powershell v4 Bugs | ||
|
|
||
| **TrackedResource Location conflict (v6 common-types):** | ||
| Models inheriting from TrackedResource via allOf may generate duplicate `Location`/`Location1` properties. Fix by adding a directive to change the allOf to inherit from `Resource` instead and inline `tags`/`location` properties: | ||
| ```yaml | ||
| - from: swagger-document | ||
| where: $.definitions.<ModelName> | ||
| transform: >- | ||
| var trackedProps = { "tags": {...}, "location": {...} }; | ||
| if (!$.properties.tags) { $.properties.tags = trackedProps.tags; } | ||
| if (!$.properties.location) { $.properties.location = trackedProps.location; } | ||
| $.allOf = [{"$ref": "../../../../../../common-types/resource-management/v6/types.json#/definitions/Resource"}]; | ||
| return $; | ||
| ``` | ||
|
|
||
| **Parameter type conflicts (multiple operations using same parameter name):** | ||
| New operations like `SetupExtensions` may conflict with existing `MachineExtension` operations. Fix with: | ||
| ```yaml | ||
| - remove-operation: <OperationId> | ||
| ``` | ||
|
|
||
| **ISO 8601 duration parsing:** | ||
| Properties with duration format (`PT4H`) may fail to parse as `System.TimeSpan`. These need custom code in the `/custom` folder or a directive to change the property type. | ||
|
|
||
| ### Build Commands | ||
| ```powershell | ||
| # Generate (from the .Autorest directory) | ||
| autorest --use=<powershell-path> --use=<modelerfour-path> --debug | ||
|
|
||
| # Build | ||
| ./build-module.ps1 # Full build with docs | ||
| ./build-module.ps1 -NoDocs # Skip docs if platyPS missing | ||
|
|
||
| # Test | ||
| ./test-module.ps1 -Playback # Verify with existing recordings | ||
| ./test-module.ps1 -Record # Record new tests (needs Azure connection) | ||
|
|
||
| # Try out | ||
| ./run-module.ps1 # Interactive shell with module loaded | ||
| ``` | ||
|
|
||
| ### Updating Test Recordings | ||
| When only the API version changed, bulk-update recording files: | ||
| ```powershell | ||
| Get-ChildItem test/*.Recording.json | ForEach-Object { | ||
| $content = Get-Content $_.FullName -Raw | ||
| $content = $content -replace "old-api-version", "new-api-version" | ||
| Set-Content $_.FullName -Value $content -NoNewline | ||
| } | ||
| ``` | ||
| Tests using long-running operations (LRO) with unique polling URLs **must** be re-recorded live. | ||
|
|
||
| ### Git Hygiene | ||
| After autorest generation, only ConnectedMachine (or target module) files should be changed. If other files appear modified: | ||
| 1. `git reset HEAD` to unstage everything | ||
| 2. `git checkout -- <non-target-paths>` to restore | ||
| 3. Verify with `git status --short | Where-Object { $_ -notmatch "TargetModule" }` | ||
|
|
||
| ## Constraints | ||
| - NEVER cancel build commands — they can take 15-60 minutes | ||
| - NEVER modify `NuGet.Config` | ||
| - ALWAYS use commit hashes (not branch names) for API spec references | ||
| - ALWAYS add comments explaining WHY each directive exists | ||
| - ALWAYS verify the `openapi.json` path structure before updating README.md (TypeSpec vs old swagger) | ||
| - DO NOT modify files outside the target module directory without user confirmation | ||
|
|
||
| ## Output | ||
| After completing the workflow, report: | ||
| - Number of generated files | ||
| - Build status (pass/fail with error summary) | ||
| - Test results (passed/failed/skipped counts) | ||
| - Any remaining issues requiring manual intervention (e.g., live test recording needed) | ||
28 changes: 28 additions & 0 deletions
28
src/ConnectedMachine/ConnectedMachine.Autorest/Properties/AssemblyInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0 (the ""License""); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an ""AS IS"" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code | ||
| // is regenerated. | ||
|
|
||
| using System; | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] | ||
| [assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] | ||
| [assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] | ||
| [assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - ConnectedMachine")] | ||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.1.1")] | ||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.1.1")] | ||
| [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] | ||
| [assembly: System.CLSCompliantAttribute(false)] | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/ConnectedMachine/ConnectedMachine.Autorest/UX/Microsoft.HybridCompute/licenses.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 44 additions & 1 deletion
45
...ine.Autorest/UX/Microsoft.HybridCompute/locations-publishers-extensionTypes-versions.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ctedMachine/ConnectedMachine.Autorest/UX/Microsoft.HybridCompute/machines-extensions.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...achine/ConnectedMachine.Autorest/UX/Microsoft.HybridCompute/machines-licenseProfiles.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tedMachine/ConnectedMachine.Autorest/UX/Microsoft.HybridCompute/machines-runCommands.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/ConnectedMachine/ConnectedMachine.Autorest/UX/Microsoft.HybridCompute/machines.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../UX/Microsoft.HybridCompute/privateLinkScopes-networkSecurityPerimeterConfigurations.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nectedMachine/ConnectedMachine.Autorest/UX/Microsoft.HybridCompute/privateLinkScopes.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this file