Skip to content

[PS] Migrate SecurityInsights module to autorest v4#28447

Open
JoyerJin wants to merge 19 commits intomainfrom
joyer/SecurityInsights-migrate-v4
Open

[PS] Migrate SecurityInsights module to autorest v4#28447
JoyerJin wants to merge 19 commits intomainfrom
joyer/SecurityInsights-migrate-v4

Conversation

@JoyerJin
Copy link
Copy Markdown
Contributor

@JoyerJin JoyerJin commented Aug 25, 2025

Description

Preannouncement PR:

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@JoyerJin JoyerJin marked this pull request as ready for review August 26, 2025 07:24
Copilot AI review requested due to automatic review settings August 26, 2025 07:24
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 migrates the SecurityInsights module from AutoRest v3 to v4, updating API models and cmdlet structure. The migration involves significant changes to parameter types, output types, and method signatures to align with the newer AutoRest framework.

Key Changes

  • Type simplification from strongly-typed enums to string parameters for improved flexibility
  • Output type namespace updates from versioned API models to unversioned ones
  • Addition of new parameter sets and JSON-based input methods for cmdlets

Reviewed Changes

Copilot reviewed 150 out of 151 changed files in this pull request and generated 3 comments.

File Description
tools/StaticAnalysis/Exceptions/Az.SecurityInsights/BreakingChangeIssues.csv Documents expected breaking changes from the AutoRest v4 migration
Multiple help markdown files Updated parameter types, output types, and documentation to reflect API changes

@VeryEarly VeryEarly added the Contains Breaking Change This PR contains breaking change label Sep 2, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 2, 2025

To the author of the pull request,
This PR was labeled "Breaking Change Release" because it contains breaking changes.

  • According to our policy, breaking changes can only take place during major release and they must be preannounced.
  • Please follow our guide on the detailed steps.
  • Required: Please fill in the task below to facilitate our contact,you will receive notifications related to breaking changes.

@isra-fel isra-fel added the autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 label Oct 2, 2025
@Pan-Qi Pan-Qi marked this pull request as draft January 8, 2026 07:19
@Pan-Qi Pan-Qi marked this pull request as ready for review January 9, 2026 05:13
Copilot AI review requested due to automatic review settings January 9, 2026 05:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 152 out of 153 changed files in this pull request and generated no new comments.

@isra-fel isra-fel added this to the Az 16.0.0 (TBD) milestone Jan 28, 2026
@isra-fel
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copilot AI review requested due to automatic review settings March 16, 2026 05:35
@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 16, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 152 out of 153 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/SecurityInsights/SecurityInsights.Autorest/test/Update-AzSentinelOnboardingState.Tests.ps1:24

  • Both test cases are marked -skip and contain only a NotImplementedException placeholder, so there is currently no automated coverage for Update-AzSentinelOnboardingState despite the cmdlet being introduced/updated in this PR.

Suggested fix: replace these placeholders with real tests (record/playback or mocking) that execute the cmdlet for the supported parameter sets, and remove -skip once they pass reliably.

Comment on lines +59 to 60
[Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.PSArgumentCompleterAttribute("Activity","Expansion")]
[Microsoft.Azure.PowerShell.Cmdlets.SecurityInsights.Category('Body')]
@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 119 out of 231 changed files in this pull request and generated 4 comments.

---
Module Name: Az.SecurityInsights
Module Guid: a632df01-f50e-49fb-b2de-e91a0090c840
Module Guid: af57d10d-6c73-4b37-8412-1fcd11cadd1b
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module GUID in this generated reference doc doesn’t match the module manifest GUID (Az.SecurityInsights.psd1 has GUID 453d4fb9-65ec-4cf1-8358-6a0fbd995d19). This will make the reference docs inconsistent with the actual module metadata; please regenerate/fix so the GUID matches the manifest.

Suggested change
Module Guid: af57d10d-6c73-4b37-8412-1fcd11cadd1b
Module Guid: 453d4fb9-65ec-4cf1-8358-6a0fbd995d19

Copilot uses AI. Check for mistakes.
Comment on lines 17 to 22
"logicAppResourceId": {
"value": "/subscriptions/51a36d38-3b14-471f-8dde-a5867f5e51eb/resourceGroups/aspstestt6jdws/providers/Microsoft.Logic/workflows/Block-AADUser-Alert"
"value": "/subscriptions/419581d6-4853-49bd-83b6-d94bb8a77887/resourceGroups/aspstest4pr7te/providers/Microsoft.Logic/workflows/Block-AADUser-Alert"
},
"triggerUrl": {
"value": "https://prod-26.centralus.logic.azure.com:443/workflows/e25a9538589f4273ac4b33c4251b7af4/triggers/When_a_response_to_an_Azure_Sentinel_alert_is_triggered/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2FWhen_a_response_to_an_Azure_Sentinel_alert_is_triggered%2Frun&sv=1.0&sig=Hj0XFCgxJZSvdepbdqqkhAyUOVNJNiGHf8Sbpdvny6k"
"value": "https://prod-18.centralus.logic.azure.com:443/workflows/fdce5d8d4e914b7b99bd10b290075cc2/triggers/When_a_response_to_an_Azure_Sentinel_alert_is_triggered/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2FWhen_a_response_to_an_Azure_Sentinel_alert_is_triggered%2Frun&sv=1.0&sig=OV1Z3sQTFbx35g3KA-kqWwdvdY2DLKcq1wcLPj5VjRU"
}
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triggerUrl contains a Logic App callback URL with a sig= token. This is effectively a secret and shouldn’t be committed in a test deployment template; consider parameterizing it (e.g., load from env/secure pipeline variables) and ensure recordings/templates filter or redact the signature.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
{ Update-AzSentinelIncidentRelation -ResourceGroupName $env.resourceGroupName -WorkspaceName $env.workspaceName `
-IncidentId $env.UpdateincidentRelationIncidentId -RelationName $env.UpdateincidentRelationId -RelatedResourceId $bookmark.Id } | Should -Throw "already exists on incident"
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test asserts on a specific substring in the thrown error message ("already exists on incident"). Error message text can change (service wording, SDK, localization), making the test brittle; consider asserting on a more stable signal such as HTTP status code (409) / error code, or exception type.

Copilot uses AI. Check for mistakes.
@@ -30,7 +31,6 @@ Describe 'Update-AzSentinelIncidentRelation' {
-QueryStartTime (get-date).ToUniversalTime() -QueryEndTime (get-date).AddDays(-1).ToUniversalTime() -EventTime (get-date).ToUniversalTime()
$incidentRelation = Get-AzSentinelIncidentRelation -ResourceGroupName $env.resourceGroupName -WorkspaceName $env.workspaceName `
-IncidentId $env.UpdateViaIdincidentRelationIncidentId -RelationName $env.UpdateViaIdincidentRelationId
$incidentRelationUpdate = Update-AzSentinelIncidentRelation -InputObject $IncidentRelation -RelatedResourceId $bookmark.Id
$incidentRelationUpdate.RelatedResourceId | should -be $bookmark.id
{ Update-AzSentinelIncidentRelation -InputObject $IncidentRelation -RelatedResourceId $bookmark.Id } | Should -Throw "already exists on incident"
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: matching the thrown exception by message text ("already exists on incident") is fragile. Prefer asserting on status code/error code/exception type so the test doesn’t break on minor wording changes.

Copilot uses AI. Check for mistakes.
@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 26, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copilot AI review requested due to automatic review settings March 27, 2026 07:32
@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 27, 2026

/azp run

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 119 out of 231 changed files in this pull request and generated no new comments.

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 27, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

…fix CredScan (#29336)

Co-authored-by: hadasi6 <hadasi6@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 30, 2026 00:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 120 out of 232 changed files in this pull request and generated 2 comments.

Comment on lines 14 to 19
"queryStartTime": {
"Value": "2022-07-28T06:00:00.000Z"
"Value": "2026-03-24T07:00:00.000Z"
},
"queryEndTime": {
"Value": "2022-07-29T06:00:00.000Z"
"Value": "2026-03-25T07:00:00.000Z"
}
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ARM deployment parameters file mixes value and Value for parameter values (e.g., queryStartTime/queryEndTime). The schema uses value (lowercase); using Value may cause deployments to ignore the parameter or fail validation. Normalize these to value for consistency and correctness.

Copilot uses AI. Check for mistakes.
Comment on lines 26 to 28
"workspaceName": {
"Value": "asptest1qlb2s"
"Value": "asptest4yt0n3"
}
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workspaceName uses Value (capital V) instead of the standard value property in ARM deployment parameters. This is inconsistent with the rest of the file and may break template parameter binding; use value consistently.

Copilot uses AI. Check for mistakes.
@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 30, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

…Scan (#29339)

Co-authored-by: hadasi6 <hadasi6@users.noreply.github.com>
@NoriZC
Copy link
Copy Markdown
Contributor

NoriZC commented Mar 31, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Copilot AI review requested due to automatic review settings April 8, 2026 02:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 120 out of 232 changed files in this pull request and generated 1 comment.

Comment on lines +18 to 26
# The incidents/relations endpoint returns 409 when updating an existing relation's target.

It 'UpdateExpanded' {
$bookmark = New-AzSentinelBookmark -ResourceGroupName $env.resourceGroupName `
-Id $env.UpdateincidentRelationBookmarkId2 -WorkspaceName $env.workspaceName -DisplayName $env.UpdateincidentRelationBookmarkName2 -Query "SecurityEvent\n| take 1" `
-QueryStartTime (get-date).ToUniversalTime() -QueryEndTime (get-date).AddDays(-1).ToUniversalTime() -EventTime (get-date).ToUniversalTime()
$incidentRelation = Update-AzSentinelIncidentRelation -ResourceGroupName $env.resourceGroupName -WorkspaceName $env.workspaceName `
-IncidentId $env.UpdateincidentRelationIncidentId -RelationName $env.UpdateincidentRelationId -RelatedResourceId $bookmark.Id
$incidentRelation.RelatedResourceId | should -be $bookmark.id
{ Update-AzSentinelIncidentRelation -ResourceGroupName $env.resourceGroupName -WorkspaceName $env.workspaceName `
-IncidentId $env.UpdateincidentRelationIncidentId -RelationName $env.UpdateincidentRelationId -RelatedResourceId $bookmark.Id } | Should -Throw "already exists on incident"
}
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test now asserts Should -Throw "already exists on incident", which couples the test to an exact/partial error message that can change with service wording, localization, or SDK error formatting. Prefer asserting on a stable signal (e.g., HTTP status code 409, an error code, or exception type) while still documenting the expected conflict behavior in the comment.

Copilot uses AI. Check for mistakes.
@VeryEarly
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autorest v4 migration pr migrating module from generated by autorest.powershell v3 to v4 Contains Breaking Change This PR contains breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants