-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Microsoft.Security async operation results and statuses apis #37917
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
amih90
wants to merge
5
commits into
main
Choose a base branch
from
ami/35421676-microsoft.security-public-api
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
5 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
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...oft.Security/preview/2025-10-01-preview/examples/OperationResults/GetOperationResult.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"parameters": { | ||
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", | ||
"location": "eastus", | ||
"operationId": "00000000-0000-0000-0000-000000000000", | ||
"api-version": "2025-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": {}, | ||
"202": { | ||
"headers": { | ||
"Location": "https://management.azure.com/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/eastus/operationResults/00000000-0000-0000-0000-000000000000?api-version=2025-10-01-preview", | ||
"Retry-After": "10" | ||
} | ||
}, | ||
"204": {}, | ||
"default": { | ||
"body": { | ||
"error": { | ||
"code": "OperationNotFound", | ||
"message": "The requested operation was not found.", | ||
"target": "operationId", | ||
"details": [ | ||
{ | ||
"code": "InvalidOperationId", | ||
"message": "The operation ID '00000000-0000-0000-0000-000000000000' does not exist or has expired." | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
109 changes: 109 additions & 0 deletions
109
...ft.Security/preview/2025-10-01-preview/examples/OperationStatuses/GetOperationStatus.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"parameters": { | ||
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", | ||
"location": "eastus", | ||
"operationId": "00000000-0000-0000-0000-000000000000", | ||
"api-version": "2025-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/eastus/operationStatuses/00000000-0000-0000-0000-000000000000", | ||
"name": "00000000-0000-0000-0000-000000000000", | ||
"status": "Succeeded", | ||
"startTime": "2025-10-01T10:00:00.000Z", | ||
"endTime": "2025-10-01T10:05:00.000Z", | ||
"percentComplete": 100.0 | ||
}, | ||
"description": "Status: Succeeded" | ||
}, | ||
"default": { | ||
"body": { | ||
"error": { | ||
"code": "OperationNotFound", | ||
"message": "The requested operation was not found.", | ||
"target": "operationId", | ||
"details": [ | ||
{ | ||
"code": "InvalidOperationId", | ||
"message": "The operation ID does not exist or has expired." | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"examples": { | ||
"InProgress": { | ||
"parameters": { | ||
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", | ||
"location": "eastus", | ||
"operationId": "11111111-1111-1111-1111-111111111111", | ||
"api-version": "2025-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/eastus/operationStatuses/11111111-1111-1111-1111-111111111111", | ||
"name": "11111111-1111-1111-1111-111111111111", | ||
"status": "InProgress", | ||
"startTime": "2025-10-01T10:00:00.000Z", | ||
"percentComplete": 45.5 | ||
} | ||
} | ||
} | ||
}, | ||
"Failed": { | ||
"parameters": { | ||
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", | ||
"location": "eastus", | ||
"operationId": "22222222-2222-2222-2222-222222222222", | ||
"api-version": "2025-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/eastus/operationStatuses/22222222-2222-2222-2222-222222222222", | ||
"name": "22222222-2222-2222-2222-222222222222", | ||
"status": "Failed", | ||
"startTime": "2025-10-01T10:00:00.000Z", | ||
"endTime": "2025-10-01T10:02:30.000Z", | ||
"percentComplete": 100.0, | ||
"error": { | ||
"code": "ResourceValidationFailed", | ||
"message": "The resource validation failed with the following error: Invalid configuration provided.", | ||
"target": "privateLink", | ||
"details": [ | ||
{ | ||
"code": "InvalidParameter", | ||
"message": "The parameter 'groupIds' is invalid.", | ||
"target": "groupIds" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"Canceled": { | ||
"parameters": { | ||
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", | ||
"location": "westus", | ||
"operationId": "33333333-3333-3333-3333-333333333333", | ||
"api-version": "2025-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westus/operationStatuses/33333333-3333-3333-3333-333333333333", | ||
"name": "33333333-3333-3333-3333-333333333333", | ||
"status": "Canceled", | ||
"startTime": "2025-10-01T09:00:00.000Z", | ||
"endTime": "2025-10-01T09:01:15.000Z", | ||
"percentComplete": 25.0 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...osoft.Security/preview/2025-10-01-preview/examples/Operations/ListOperations_example.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"parameters": { | ||
"api-version": "2025-10-01-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"value": [ | ||
{ | ||
"name": "Microsoft.Security/defenderforstoragesettings/read", | ||
"display": { | ||
"provider": "Microsoft Security", | ||
"resource": "DefenderForStorageSettings", | ||
"operation": "Get defenderForStorageSettings", | ||
"description": "Gets the defenderforstoragesettings for the scope" | ||
}, | ||
"origin": "user" | ||
}, | ||
{ | ||
"name": "Microsoft.Security/defenderforstoragesettings/write", | ||
"display": { | ||
"provider": "Microsoft Security", | ||
"resource": "DefenderForStorageSettings", | ||
"operation": "Update defenderForStorageSettings", | ||
"description": "Creates or updates the defenderforstoragesettings for the scope" | ||
}, | ||
"origin": "user" | ||
}, | ||
{ | ||
"name": "Microsoft.Security/defenderforstoragesettings/delete", | ||
"display": { | ||
"provider": "Microsoft Security", | ||
"resource": "DefenderForStorageSettings", | ||
"operation": "Delete defenderForStorageSettings", | ||
"description": "Deletes the defenderforstoragesettings for the scope" | ||
}, | ||
"origin": "user" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
...rity/resource-manager/Microsoft.Security/preview/2025-10-01-preview/operationResults.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
Check notice on line 1 in specification/security/resource-manager/Microsoft.Security/preview/2025-10-01-preview/operationResults.json
|
||
"swagger": "2.0", | ||
"info": { | ||
"title": "Microsoft Defender for Cloud", | ||
"description": "API spec for Microsoft Defender for Cloud operation results.", | ||
"version": "2025-10-01-preview" | ||
}, | ||
"host": "management.azure.com", | ||
"schemes": [ | ||
"https" | ||
], | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"security": [ | ||
{ | ||
"azure_auth": [ | ||
"user_impersonation" | ||
] | ||
} | ||
], | ||
"securityDefinitions": { | ||
"azure_auth": { | ||
"type": "oauth2", | ||
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", | ||
"flow": "implicit", | ||
"description": "Azure Active Directory OAuth2 Flow", | ||
"scopes": { | ||
"user_impersonation": "impersonate your user account" | ||
} | ||
} | ||
}, | ||
"paths": { | ||
"/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{location}/operationResults/{operationId}": { | ||
"get": { | ||
"x-ms-examples": { | ||
"Get operation result": { | ||
"$ref": "./examples/OperationResults/GetOperationResult.json" | ||
} | ||
}, | ||
"tags": [ | ||
"OperationResults" | ||
], | ||
"description": "Returns operation results for long running operations.", | ||
"operationId": "OperationResults_Get", | ||
"parameters": [ | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/SubscriptionIdParameter" | ||
}, | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/LocationParameter" | ||
}, | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/OperationIdParameter" | ||
}, | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/ApiVersionParameter" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "The operation has completed successfully." | ||
}, | ||
"202": { | ||
"description": "The operation is still in progress.", | ||
"headers": { | ||
"Location": { | ||
"description": "URL to query for status of the operation.", | ||
"type": "string" | ||
}, | ||
"Retry-After": { | ||
"description": "The recommended number of seconds to wait before calling the URI specified in the Location header.", | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
}, | ||
"204": { | ||
"description": "The operation has completed successfully with no content." | ||
}, | ||
"default": { | ||
"description": "Error response describing why the operation failed.", | ||
"schema": { | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/definitions/ErrorResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...ity/resource-manager/Microsoft.Security/preview/2025-10-01-preview/operationStatuses.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
Check notice on line 1 in specification/security/resource-manager/Microsoft.Security/preview/2025-10-01-preview/operationStatuses.json
|
||
"swagger": "2.0", | ||
"info": { | ||
"title": "Microsoft Defender for Cloud", | ||
"description": "API spec for Microsoft Defender for Cloud operation statuses.", | ||
"version": "2025-10-01-preview" | ||
}, | ||
"host": "management.azure.com", | ||
"schemes": [ | ||
"https" | ||
], | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"security": [ | ||
{ | ||
"azure_auth": [ | ||
"user_impersonation" | ||
] | ||
} | ||
], | ||
"securityDefinitions": { | ||
"azure_auth": { | ||
"type": "oauth2", | ||
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", | ||
"flow": "implicit", | ||
"description": "Azure Active Directory OAuth2 Flow", | ||
"scopes": { | ||
"user_impersonation": "impersonate your user account" | ||
} | ||
} | ||
}, | ||
"paths": { | ||
"/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{location}/operationStatuses/{operationId}": { | ||
"get": { | ||
"x-ms-examples": { | ||
"Get operation status": { | ||
"$ref": "./examples/OperationStatuses/GetOperationStatus.json" | ||
} | ||
}, | ||
"tags": [ | ||
"OperationStatuses" | ||
], | ||
"description": "Get the status of a long running azure asynchronous operation.", | ||
"operationId": "OperationStatuses_Get", | ||
"parameters": [ | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/SubscriptionIdParameter" | ||
}, | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/LocationParameter" | ||
}, | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/OperationIdParameter" | ||
}, | ||
{ | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/ApiVersionParameter" | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK. Operation status.", | ||
"schema": { | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/definitions/OperationStatusResult" | ||
} | ||
}, | ||
"default": { | ||
"description": "Error response describing why the operation failed.", | ||
"schema": { | ||
"$ref": "../../../../../common-types/resource-management/v6/types.json#/definitions/ErrorResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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.
When reading the operation resource entity, the status code should always be 200. The response payload indicates if the async operation is still running or has completed (successfully or with a failure).
See here:
https://github.com/cloud-and-ai-microsoft/resource-provider-contract/blob/master/v1.0/async-api-reference.md#asynchronous-operations
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 check the table at https://github.com/cloud-and-ai-microsoft/resource-provider-contract/blob/master/v1.0/async-api-reference.md#example-flow
operation results has 202 and Location, RetryAfter support. tried to map it again and updated the PR accordingly