Migrate Kusto to autorest v4#28431
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
Pull request overview
This pull request migrates the Kusto PowerShell module from AutoRest v3 to AutoRest v4, introducing breaking changes primarily in cmdlet help documentation and API surface. The migration affects parameter types, parameter sets, model namespaces, and removes certain cmdlets related to private endpoints.
Changes:
- Updates help documentation for all Kusto cmdlets with new parameter sets and type changes
- Removes API version-specific namespaces from model references
- Adds new parameter sets for JSON file/string inputs
- Updates ChangeLog.md with breaking change notice
- Removes three private endpoint-related cmdlet help files
- Updates test files to use new model namespaces
Reviewed changes
Copilot reviewed 164 out of 164 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Kusto/Kusto/ChangeLog.md | Added breaking change notice for AutoRest v4 migration |
| src/Kusto/Kusto/help/*.md (multiple) | Updated cmdlet help with new parameter sets, type changes, and namespace updates |
| src/Kusto/Kusto/help/Remove-AzKustoPrivateEndpointConnection.md | Removed entire file |
| src/Kusto/Kusto/help/New-AzKustoPrivateEndpointConnection.md | Removed entire file |
| src/Kusto/Kusto/help/Get-AzKustoPrivateLinkResource.md | Removed entire file |
| src/Kusto/Kusto/help/Get-AzKustoPrivateEndpointConnection.md | Removed entire file |
| src/Kusto/Kusto.Autorest/test/Remove-AzKustoClusterCalloutPolicy.Tests.ps1 | Updated model namespace references |
| src/Kusto/Kusto.Autorest/generate-info.json | Updated generation ID |
|
To the author of the pull request, |
dc0fbce to
5d4e83c
Compare
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." | ||
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." No newline at end of file |
| - Additional information about change #1 | ||
| --> | ||
| ## Upcoming Release | ||
| * Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249). |
| - where: | ||
| variant: ^(Add|Check|Detach)(?!.*?(Expanded|JsonFilePath|JsonString)) | ||
| remove: true | ||
|
|
| --- | ||
| Module Name: Az.Kusto | ||
| Module Guid: 18c61846-f6f0-425e-ba4b-5cf903e2bdd8 | ||
| Module Guid: 04ffad84-367b-441f-bb50-32480557d17e |
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." | ||
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." |
| $scriptContent | Out-File -FilePath (Join-Path $env:TEMP $blobName) -Encoding utf8 -Force | ||
| Set-AzStorageBlobContent -File (Join-Path $env:TEMP $blobName) -Container $containerName -Blob $blobName -Context $ctx -Force |
| $storageAccountName = $env.storageAccountName | ||
| $containerName = "scripts" | ||
| $blobName = "update-script.kql" | ||
| if ($TestMode -ne 'playback') { |
| if(($null -eq $TestName) -or ($TestName -contains 'Get-AzKustoOperationsResultsLocation')) | ||
| { | ||
| $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' | ||
| if (-Not (Test-Path -Path $loadEnvPath)) { | ||
| $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' | ||
| } | ||
| . ($loadEnvPath) | ||
| $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzKustoOperationsResultsLocation.Recording.json' | ||
| $currentPath = $PSScriptRoot | ||
| while(-not $mockingPath) { | ||
| $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File | ||
| $currentPath = Split-Path -Path $currentPath -Parent | ||
| } | ||
| . ($mockingPath | Select-Object -First 1).FullName | ||
| } | ||
|
|
||
| Describe 'Get-AzKustoOperationsResultsLocation' { | ||
| It 'GetViaIdentityLocation' -skip { | ||
| { throw [System.NotImplementedException] } | Should -Not -Throw | ||
| } | ||
| } |
| It 'UpdateViaIdentityExpandedCMK' -skip{ | ||
| $clusterName = $env.kustoClusterName | ||
| $resourceGroupName = $env.resourceGroupName |
| It 'CreateWithCMK' -skip { | ||
| $name = "testdatabase" + $env.rstr6 | ||
| $databaseFullName = $env.kustoClusterName + "/" + $name |
| @@ -94,7 +94,7 @@ Describe 'Update-AzKustoDatabase' { | |||
| { Invoke-AzKustoDetachClusterFollowerDatabase -ResourceGroupName $resourceGroupName -ClusterName $clusterName -AttachedDatabaseConfigurationName $attachedDatabaseConfigurationName -ClusterResourceId $followerClusterResourceId } | Should -Not -Throw | |||
| } | |||
|
|
|||
| It 'UpdateViaIdentityExpandedCMK' { | |||
| It 'UpdateViaIdentityExpandedCMK' -skip{ | |||
| forceUpdateTag = "tag2" | ||
| continueOnErrors = $true | ||
| scriptLevel = "Database" | ||
| principalPermissionsAction = "RemovePermissionOnScriptCompletion" | ||
| } |
| ## Upcoming Release | ||
| * Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249). | ||
| * Preannounced breaking changes. Please refer to https://go.microsoft.com/fwlink/?linkid=2333229 |
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." | ||
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." |
| ### Example 1: Update an existing kusto script by name | ||
| ```powershell | ||
| Update-AzKustoScript -DatabaseName mykustodatabase -Name newkustoscript -ClusterName testnewkustocluster -ResourceGroupName testrg -ScriptUrl $BlobSASURL -ScriptUrlSasToken $BlobSASToken -PrincipalPermissionsAction RemovePermissionOnScriptCompletion -ScriptLevel Database | ||
| Update-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $resourceGroupName -SubscriptionId $SubscriptionId -JsonString $jsonBody | ||
| ``` |
| if ($TestMode -ne 'playback') { | ||
| $storageAccount = Get-AzStorageAccount -ResourceGroupName $env.resourceGroupName -Name $storageAccountName | ||
| $ctx = $storageAccount.Context | ||
| New-AzStorageContainer -Name $containerName -Context $ctx -Permission Off -ErrorAction SilentlyContinue | ||
| $scriptContent | Out-File -FilePath (Join-Path $env:TEMP $blobName) -Encoding utf8 -Force | ||
| Set-AzStorageBlobContent -File (Join-Path $env:TEMP $blobName) -Container $containerName -Blob $blobName -Context $ctx -Force |
| Describe 'Update-AzKustoPrivateEndpointConnection' { | ||
| It 'UpdateExpanded' -skip { | ||
| { throw [System.NotImplementedException] } | Should -Not -Throw | ||
| } | ||
|
|
||
| It 'Update' -skip { |
| Describe 'Get-AzKustoOperationsResultsLocation' { | ||
| It 'GetViaIdentityLocation' -skip { | ||
| { throw [System.NotImplementedException] } | Should -Not -Throw | ||
| } |
| It 'CreateWithCMK' -skip { | ||
| $name = "testdatabase" + $env.rstr6 | ||
| $databaseFullName = $env.kustoClusterName + "/" + $name | ||
| $keyVaultPropertyKeyName = $env.keyName |
| ## OUTPUTS | ||
|
|
||
| ### System.String | ||
| ### Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.IDiagnoseVirtualNetworkResult | ||
|
|
| ## OUTPUTS | ||
|
|
||
| ### System.String | ||
| ### Microsoft.Azure.PowerShell.Cmdlets.Kusto.Models.IDiagnoseVirtualNetworkResult | ||
|
|
|
|
|
Don't merge this PR till the service team has done the test. |
|
Hi @Pan-Qi and @JiaSeng-v, please fix test errors. |
Hi @YanaXu , we’ve requested the service team to help fix the test errors. It might take some time. Thanks |
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." | ||
| "Az.Kusto","Update-AzKustoScript","1","1","Invalid_Parameter_Name","5011","1","Update-AzKustoScript -ScriptUrlSasToken is not a valid parameter name.","-ScriptUrlSasToken","Check validity of the parameter -ScriptUrlSasToken." |
| $scriptContent | Out-File -FilePath (Join-Path $env:TEMP $blobName) -Encoding utf8 -Force | ||
| Set-AzStorageBlobContent -File (Join-Path $env:TEMP $blobName) -Container $containerName -Blob $blobName -Context $ctx -Force |
| $sasToken = New-AzStorageBlobSASToken -Container $containerName -Blob $blobName -Context $ctx -Permission r -ExpiryTime (Get-Date).AddHours(1) | ||
| } else { | ||
| $sasToken = "?sv=faketoken" | ||
| } | ||
| $scriptUrl = "https://$storageAccountName.blob.core.windows.net/$containerName/$blobName" | ||
|
|
||
| $jsonBody = @{ | ||
| properties = @{ | ||
| scriptUrl = $scriptUrl | ||
| scriptUrlSasToken = $sasToken | ||
| forceUpdateTag = "tag2" |
| ## Upcoming Release | ||
| * Improved user experience and consistency. This may introduce breaking changes. Please refer to [here](https://go.microsoft.com/fwlink/?linkid=2340249). | ||
| * Preannounced breaking changes. Please refer to https://go.microsoft.com/fwlink/?linkid=2333229 |
| ### Example 1: Update an existing kusto script by name | ||
| ```powershell | ||
| Update-AzKustoScript -DatabaseName mykustodatabase -Name newkustoscript -ClusterName testnewkustocluster -ResourceGroupName testrg -ScriptUrl $BlobSASURL -ScriptUrlSasToken $BlobSASToken -PrincipalPermissionsAction RemovePermissionOnScriptCompletion -ScriptLevel Database | ||
| Update-AzKustoScript -ClusterName $clusterName -DatabaseName $databaseName -Name $scriptName -ResourceGroupName $resourceGroupName -SubscriptionId $SubscriptionId -JsonString $jsonBody | ||
| ``` |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 102 out of 233 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (4)
src/Kusto/Kusto.Autorest/test/Get-AzKustoOperationsResultsLocation.Tests.ps1:1
- The cmdlet/test name uses
Get-AzKustoOperationsResultsLocation(Results, plural), but the regenerated help/docs in this PR appear to be forGet-AzKustoOperationsResultLocation(Result, singular). If the actual cmdlet is singular, this test won't be discoverable/consistent and its recording filename will also be misnamed. Please align the testDescribe,$TestNamefilter, and$TestRecordingFileto the real cmdlet name.
src/Kusto/Kusto.Autorest/test/Get-AzKustoOperationsResultsLocation.Tests.ps1:1 - The cmdlet/test name uses
Get-AzKustoOperationsResultsLocation(Results, plural), but the regenerated help/docs in this PR appear to be forGet-AzKustoOperationsResultLocation(Result, singular). If the actual cmdlet is singular, this test won't be discoverable/consistent and its recording filename will also be misnamed. Please align the testDescribe,$TestNamefilter, and$TestRecordingFileto the real cmdlet name.
src/Kusto/Kusto.Autorest/examples/Update-AzKustoScript.md:1 - This updated example references variables ($clusterName/$databaseName/$scriptName/$resourceGroupName/$SubscriptionId/$jsonBody) that aren’t defined in the example, so it’s not copy/paste runnable. Consider either using placeholder literals (e.g.,
<clusterName>) consistent with other examples, or expand the example to show how$jsonBody(includingscriptUrl/scriptUrlSasToken) is constructed.
src/Kusto/Kusto.Autorest/examples/Add-AzKustoClusterCalloutPolicy.md:1 - The example still uses
calloutUriRegex = \"*\", but related tests in this PR were updated to use\".*\"(valid regex). To avoid confusing users and to keep docs consistent with tests/service expectations, please update the example to a proper regex pattern (e.g.,.*) if the field is truly regex-based.
| [assembly: System.Reflection.AssemblyFileVersionAttribute("2.4.1")] | ||
| [assembly: System.Reflection.AssemblyVersionAttribute("2.4.1")] |
Description
Preannouncement PR: #29495
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.