-
Couldn't load subscription status.
- Fork 4.1k
[Az.Compute] Update generation tool version: autorest.powershell v3->v4 #28303
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
base: main
Are you sure you want to change the base?
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
|
To the author of the pull request, |
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.
Pull Request Overview
This PR updates the autorest PowerShell generation tool from version 3 to version 4 for the Az.Compute module. The update introduces new API patterns, parameter sets, and breaking changes to support the newer autorest.powershell v4 generation framework.
Key changes include:
- Migration from API versioned types to generic interface types in cmdlet signatures
- Addition of new parameter sets with JSON file and string input options
- Introduction of new identity-based parameter sets for better resource management
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/StaticAnalysis/Exceptions/Az.Compute/BreakingChangeIssues.csv | Added 35 new breaking change exceptions for type and parameter changes introduced by autorest v4 |
| Multiple help/*.md files | Updated parameter sets, types, and documentation to reflect new autorest v4 patterns |
| Multiple docs/*.md files | Updated autorest-generated documentation with new parameter sets and type signatures |
| src/Compute/Compute.Autorest/generate-info.json | Updated generation ID for new autorest v4 build |
| src/Compute/Compute.Autorest/README.md | Removed explicit autorest v3 configuration and updated directive patterns |
| Multiple custom/*.ps1 files | Updated custom cmdlet implementations with new type signatures and parameter sets |
| "Az.Compute","Get-AzGalleryApplicationVersion","Get-AzGalleryApplicationVersion","0","3000","The type of property 'ProvisioningState' of type 'Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplicationVersion' has changed from 'System.Nullable`1[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.GalleryProvisioningState]' to 'System.String'.","Change the type of property 'ProvisioningState' back to 'System.Nullable`1[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.GalleryProvisioningState]'." | ||
| "Az.Compute","Get-AzGalleryApplicationVersion","Get-AzGalleryApplicationVersion","0","3000","The type of property 'PublishingProfileReplicationMode' of type 'Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplicationVersion' has changed from 'System.Nullable`1[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.ReplicationMode]' to 'System.String'.","Change the type of property 'PublishingProfileReplicationMode' back to 'System.Nullable`1[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.ReplicationMode]'." | ||
| "Az.Compute","Get-AzGalleryApplicationVersion","Get-AzGalleryApplicationVersion","0","3000","The type of property 'PublishingProfileStorageAccountType' of type 'Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20220103.IGalleryApplicationVersion' has changed from 'System.Nullable`1[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.StorageAccountType]' to 'System.String'.","Change the type of property 'PublishingProfileStorageAccountType' back to 'System.Nullable`1[Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.StorageAccountType]'." | ||
| "Az.Compute","Get-AzGalleryApplicationVersion","Get-AzGalleryApplicationVersion","0","2020","The cmdlet 'Get-AzGalleryApplicationVersion' no longer supports the type 'Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.ReplicationStatusTypes' for parameter 'Expand'.","Change the type for parameter 'Expand' back to 'Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.ReplicationStatusTypes'." |
Copilot
AI
Aug 22, 2025
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.
[nitpick] This breaking change from strongly-typed enum to string for the 'Expand' parameter reduces type safety. Consider if this change is necessary or if the enum type can be preserved to maintain compile-time validation.
| # 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well | ||
| - where: | ||
| variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$ | ||
| variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString)) |
Copilot
AI
Aug 22, 2025
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.
[nitpick] The regex pattern uses a negative lookahead which may be difficult to understand and maintain. Consider documenting this pattern or using a more explicit approach to specify which variants should be removed.
| [Microsoft.Azure.PowerShell.Cmdlets.Compute.PSArgumentCompleterAttribute("Windows", "Linux")] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.Compute.Category('Body')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.Compute.Support.OperatingSystemTypes] | ||
| [System.String] |
Copilot
AI
Aug 22, 2025
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.
The change from strongly-typed OperatingSystemTypes enum to string reduces type safety and removes IntelliSense support. The PSArgumentCompleter attribute helps but doesn't provide the same compile-time validation as the original enum type.
| Update-AzGalleryApplicationVersion -GalleryApplicationName <String> -GalleryName <String> -Name <String> | ||
| -ResourceGroupName <String> -PackageFileLink <String> [-SubscriptionId <String>] | ||
| [-DefaultConfigFileLink <String>] [-PublishingProfileEndOfLifeDate <DateTime>] | ||
| -ResourceGroupName <String> -PackageFileLink <String> [-SubscriptionId <String>] [-ConfigFileName <String>] |
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.
Two new parameters added - ConfigFileName, PackageFileName?
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.
Yes, new parameters have been introduced in the custom file Update-AzGalleryApplicationVersion, and the service team has completed the relevant testing locally.
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.
I removed this two parameters, because these two parameters were also generated in the previous version, but they were not displayed to users.
… jinpei/main/Computer-v3tov4
…ionVersion,Because these two parameters were also generated in the previous version, but they were not displayed to users.
|
@lijinpei2008 While the changes look good to me, we'll hold on merging until early Nov. At the meantime, could you help authorize a markdown like this for each of the breaking change? We'll need it for publishing migration guides. Just leave a comment in the issue would be fine. Thank you! ## Az.Accounts
### `Get-AzAccessToken`
The default output type is changed from `PSAccessToken` to `PSSecureAccessToken`.That is to change plaintext `PSAccessToken.Token` to `SecureString PSSecureAccessToken.Token`
#### Before
```powershell
$authHeader = @{
'Content-Type' = 'application/json'
'Authorization' = 'Bearer ' + (Get-AccessToken).Token
}
$response = Invoke-RestMethod -Method Get -Headers $authHeader -Uri $uri
```
#### After
```powershell
$secureToken = (Get-AzAccessToken).Token
$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureToken)
try {
$plaintextToken = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr)
}
finally {
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr)
}
$authHeader = @{
'Content-Type' = 'application/json'
'Authorization' = 'Bearer ' + $plaintextToken
}
$response = Invoke-RestMethod -Method Get -Headers $authHeader -Uri $uri
``` |
Description
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.