{ "swagger": "2.0", "info": { "title": "Security Insights", "description": "API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider", "version": "2025-06-01" }, "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories": { "post": { "x-ms-examples": { "Get repository list.": { "$ref": "./examples/repositories/GetRepositories.json" } }, "tags": [ "Repositories" ], "description": "Gets a list of repositories metadata.", "operationId": "SourceControl_listRepositories", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./common/2.0/types.json#/parameters/WorkspaceName" }, { "$ref": "#/parameters/RepositoryAccess" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/RepoList" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./common/2.0/types.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols": { "get": { "x-ms-examples": { "Get all source controls.": { "$ref": "./examples/sourcecontrols/GetSourceControls.json" } }, "tags": [ "SourceControls" ], "description": "Gets all source controls, without source control items.", "operationId": "SourceControls_List", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./common/2.0/types.json#/parameters/WorkspaceName" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/SourceControlList" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./common/2.0/types.json#/definitions/CloudError" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}": { "get": { "x-ms-examples": { "Get a source control.": { "$ref": "./examples/sourcecontrols/GetSourceControlById.json" } }, "tags": [ "SourceControls" ], "description": "Gets a source control byt its identifier.", "operationId": "SourceControls_Get", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./common/2.0/types.json#/parameters/WorkspaceName" }, { "$ref": "#/parameters/SourceControlIdParameter" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/SourceControl" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./common/2.0/types.json#/definitions/CloudError" } } } }, "put": { "x-ms-examples": { "Creates or updates a source control.": { "$ref": "./examples/sourcecontrols/CreateSourceControl.json" } }, "tags": [ "SourceControls" ], "description": "Creates a source control.", "operationId": "SourceControls_Create", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./common/2.0/types.json#/parameters/WorkspaceName" }, { "$ref": "#/parameters/SourceControlIdParameter" }, { "$ref": "#/parameters/SourceControl" } ], "responses": { "200": { "description": "Updated", "schema": { "$ref": "#/definitions/SourceControl" } }, "201": { "description": "Created", "schema": { "$ref": "#/definitions/SourceControl" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./common/2.0/types.json#/definitions/CloudError" } } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}/delete": { "post": { "x-ms-examples": { "Delete a source control.": { "$ref": "./examples/sourcecontrols/DeleteSourceControl.json" } }, "tags": [ "SourceControls" ], "description": "Delete a source control.", "operationId": "SourceControls_Delete", "parameters": [ { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./common/2.0/types.json#/parameters/WorkspaceName" }, { "$ref": "#/parameters/SourceControlIdParameter" }, { "$ref": "#/parameters/RepositoryAccess" } ], "responses": { "200": { "description": "Source control deleted.", "schema": { "$ref": "#/definitions/Warning" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./common/2.0/types.json#/definitions/CloudError" } } } } } }, "definitions": { "RepoList": { "description": "List all the source controls.", "properties": { "nextLink": { "description": "URL to fetch the next set of repositories.", "readOnly": true, "type": "string" }, "value": { "description": "Array of repositories.", "items": { "$ref": "#/definitions/Repo" }, "type": "array", "x-ms-identifiers": [] } }, "required": [ "value" ], "type": "object" }, "Repo": { "description": "Represents a repository.", "properties": { "url": { "description": "The url to access the repository.", "type": "string" }, "fullName": { "description": "The name of the repository.", "type": "string" }, "installationId": { "description": "The installation id of the repository.", "type": "integer", "format": "int64" }, "branches": { "description": "Array of branches.", "items": { "description": "name of branch.", "type": "string" }, "type": "array" } }, "x-ms-azure-resource": false, "type": "object" }, "SourceControlList": { "description": "List all the source controls.", "properties": { "nextLink": { "description": "URL to fetch the next set of source controls.", "readOnly": true, "type": "string" }, "value": { "description": "Array of source controls.", "items": { "$ref": "#/definitions/SourceControl" }, "type": "array" } }, "required": [ "value" ], "type": "object" }, "SourceControl": { "allOf": [ { "$ref": "./common/2.0/types.json#/definitions/ResourceWithEtag" } ], "description": "Represents a SourceControl in Azure Security Insights.", "required": [ "properties" ], "properties": { "properties": { "description": "source control properties", "$ref": "#/definitions/SourceControlProperties", "x-ms-client-flatten": true } }, "type": "object" }, "SourceControlProperties": { "description": "Describes source control properties", "properties": { "id": { "description": "The id (a Guid) of the source control", "type": "string", "readOnly": true }, "version": { "$ref": "#/definitions/Version", "description": "The version number associated with the source control", "type": "string" }, "displayName": { "description": "The display name of the source control", "type": "string" }, "description": { "description": "A description of the source control", "type": "string" }, "repoType": { "$ref": "#/definitions/RepoType", "description": "The repository type of the source control", "type": "string" }, "contentTypes": { "description": "Array of source control content types.", "items": { "$ref": "#/definitions/ContentType" }, "type": "array" }, "repository": { "description": "Repository metadata.", "$ref": "#/definitions/Repository" }, "servicePrincipal": { "description": "Service principal metadata.", "$ref": "#/definitions/ServicePrincipal" }, "workloadIdentityFederation": { "description": "Workload Identity metadata.", "$ref": "#/definitions/WorkloadIdentityFederation", "readOnly": true }, "repositoryAccess": { "description": "Repository access credentials. This is write-only object and it never returns back to a user.", "x-ms-mutability": [ "create", "update" ], "$ref": "#/definitions/RepositoryAccess" }, "repositoryResourceInfo": { "description": "Information regarding the resources created in user's repository.", "$ref": "#/definitions/RepositoryResourceInfo" }, "lastDeploymentInfo": { "description": "Information regarding the latest deployment for the source control.", "$ref": "#/definitions/DeploymentInfo" }, "pullRequest": { "description": "Information regarding the pull request of the source control.", "$ref": "#/definitions/PullRequest" } }, "required": [ "displayName", "repoType", "contentTypes", "repository" ], "type": "object" }, "RepositoryAccess": { "type": "object", "description": "Credentials to access repository.", "required": [ "kind" ], "properties": { "kind": { "description": "The kind of repository access credentials", "$ref": "#/definitions/RepositoryAccessKind" }, "code": { "x-ms-secret": true, "type": "string", "description": "OAuth Code. Required when `kind` is `OAuth`" }, "state": { "x-ms-secret": true, "type": "string", "description": "OAuth State. Required when `kind` is `OAuth`" }, "clientId": { "type": "string", "description": "OAuth ClientId. Required when `kind` is `OAuth`" }, "token": { "x-ms-secret": true, "type": "string", "description": "Personal Access Token. Required when `kind` is `PAT`" }, "installationId": { "type": "string", "description": "Application installation ID. Required when `kind` is `App`. Supported by `GitHub` only." } } }, "RepositoryAccessObject": { "description": "Credentials to access repository.", "type": "object", "required": [ "repositoryAccess" ], "properties": { "repositoryAccess": { "description": "RepositoryAccess properties", "$ref": "#/definitions/RepositoryAccess", "x-ms-client-flatten": true } } }, "RepositoryAccessProperties": { "description": "Credentials to access repository.", "type": "object", "required": [ "properties" ], "properties": { "properties": { "description": "RepositoryAccess properties", "$ref": "#/definitions/RepositoryAccessObject", "x-ms-client-flatten": true } } }, "Repository": { "type": "object", "required": [ "url", "branch" ], "description": "metadata of a repository.", "properties": { "url": { "description": "Url of repository.", "type": "string" }, "branch": { "description": "Branch name of repository.", "type": "string" }, "displayUrl": { "description": "Display url of repository.", "type": "string" }, "deploymentLogsUrl": { "description": "Url to access repository action logs.", "type": "string", "readOnly": true } } }, "ServicePrincipal": { "type": "object", "description": "Service principal metadata.", "properties": { "id": { "description": "Id of service principal.", "type": "string", "readOnly": true }, "tenantId": { "description": "Tenant id of service principal.", "type": "string", "readOnly": true }, "appId": { "description": "App id of service principal.", "type": "string", "readOnly": true }, "credentialsExpireOn": { "format": "date-time", "description": "Expiration time of service principal credentials.", "type": "string" } } }, "WorkloadIdentityFederation": { "type": "object", "description": "Workload Identity Federation metadata.", "properties": { "id": { "description": "Id of Workload Identity Federation.", "type": "string", "readOnly": true }, "tenantId": { "description": "Tenant id of Workload Identity Federation.", "type": "string", "readOnly": true }, "appId": { "description": "App id of Workload Identity Federation.", "type": "string", "readOnly": true }, "subject": { "description": "Subject of Workload Identity Federation.", "type": "string", "readOnly": true }, "issuer": { "description": "Issuer of Workload Identity Federation.", "type": "string", "readOnly": true } } }, "RepositoryResourceInfo": { "type": "object", "description": "Resources created in user's repository for the source-control.", "properties": { "webhook": { "type": "object", "description": "The webhook object created for the source-control.", "$ref": "#/definitions/Webhook" }, "gitHubResourceInfo": { "type": "object", "description": "Resources created in GitHub for this source-control.", "$ref": "#/definitions/GitHubResourceInfo" }, "azureDevOpsResourceInfo": { "type": "object", "description": "Resources created in Azure DevOps for this source-control.", "$ref": "#/definitions/AzureDevOpsResourceInfo" } } }, "Webhook": { "description": "Detail about the webhook object.", "type": "object", "properties": { "webhookId": { "description": "Unique identifier for the webhook.", "type": "string", "readOnly": true }, "webhookUrl": { "description": "URL that gets invoked by the webhook.", "type": "string", "readOnly": true }, "webhookSecretUpdateTime": { "format": "date-time", "description": "Time when the webhook secret was updated.", "type": "string", "readOnly": true }, "rotateWebhookSecret": { "description": "A flag to instruct the backend service to rotate webhook secret.", "type": "boolean" } } }, "GitHubResourceInfo": { "readOnly": true, "description": "Resources created in GitHub repository.", "type": "object", "properties": { "appInstallationId": { "description": "GitHub application installation id.", "type": "string" } } }, "AzureDevOpsResourceInfo": { "readOnly": true, "description": "Resources created in Azure DevOps repository.", "type": "object", "properties": { "pipelineId": { "description": "Id of the pipeline created for the source-control.", "type": "string" }, "serviceConnectionId": { "description": "Id of the service-connection created for the source-control.", "type": "string" } } }, "DeploymentInfo": { "readOnly": true, "description": "Information regarding a deployment.", "type": "object", "properties": { "deploymentFetchStatus": { "$ref": "#/definitions/DeploymentFetchStatus", "description": "Status while fetching the last deployment.", "type": "string" }, "deployment": { "$ref": "#/definitions/Deployment", "description": "Deployment information.", "type": "object" }, "message": { "description": "Additional details about the deployment that can be shown to the user.", "type": "string" } } }, "Deployment": { "description": "Description about a deployment.", "type": "object", "properties": { "deploymentId": { "description": "Deployment identifier.", "type": "string" }, "deploymentState": { "$ref": "#/definitions/DeploymentState", "description": "Current status of the deployment.", "type": "string" }, "deploymentResult": { "$ref": "#/definitions/DeploymentResult", "description": "The outcome of the deployment.", "type": "string" }, "deploymentTime": { "format": "date-time", "description": "The time when the deployment finished.", "type": "string" }, "deploymentLogsUrl": { "description": "Url to access repository action logs.", "type": "string" } } }, "ContentType": { "description": "The content type of a source control path.", "enum": [ "AnalyticsRule", "AutomationRule", "HuntingQuery", "Parser", "Playbook", "Workbook" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "ContentType", "values": [ { "value": "AnalyticsRule" }, { "value": "AutomationRule" }, { "value": "HuntingQuery" }, { "value": "Parser" }, { "value": "Playbook" }, { "value": "Workbook" } ] } }, "RepoType": { "description": "The type of repository.", "enum": [ "Github", "AzureDevOps" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "RepoType", "values": [ { "value": "Github" }, { "value": "AzureDevOps" } ] } }, "RepositoryAccessKind": { "description": "The kind of repository access credentials", "enum": [ "OAuth", "PAT", "App" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "RepositoryAccessKind", "values": [ { "value": "OAuth" }, { "value": "PAT" }, { "value": "App" } ] } }, "Version": { "readOnly": true, "description": "The version of the source control.", "enum": [ "V1", "V2" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "Version", "values": [ { "value": "V1" }, { "value": "V2" } ] } }, "DeploymentFetchStatus": { "description": "Status while trying to fetch the deployment information.", "enum": [ "Success", "Unauthorized", "NotFound" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "DeploymentFetchStatus", "values": [ { "value": "Success" }, { "value": "Unauthorized" }, { "value": "NotFound" } ] } }, "DeploymentState": { "description": "The current state of the deployment.", "enum": [ "In_Progress", "Completed", "Queued", "Canceling" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "DeploymentState", "values": [ { "value": "In_Progress" }, { "value": "Completed" }, { "value": "Queued" }, { "value": "Canceling" } ] } }, "DeploymentResult": { "description": "Status while trying to fetch the deployment information.", "enum": [ "Success", "Canceled", "Failed" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "DeploymentResult", "values": [ { "value": "Success" }, { "value": "Canceled" }, { "value": "Failed" } ] } }, "PullRequest": { "readOnly": true, "description": "Information regarding pull request for protected branches.", "type": "object", "properties": { "url": { "description": "URL of pull request", "type": "string", "readOnly": true }, "state": { "$ref": "#/definitions/PullRequestState", "description": "State of the pull request", "type": "object", "readOnly": true } } }, "PullRequestState": { "description": "Status of the pull request.", "enum": [ "Open", "Closed" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "state", "values": [ { "value": "Open" }, { "value": "Closed" } ] } }, "Warning": { "description": "Warning response structure.", "properties": { "warning": { "$ref": "#/definitions/WarningBody", "description": "Warning data." } }, "type": "object" }, "WarningBody": { "readOnly": true, "description": "Warning details.", "properties": { "code": { "description": "An identifier for the warning. Codes are invariant and are intended to be consumed programmatically.", "readOnly": true, "type": "object", "$ref": "#/definitions/WarningCode" }, "message": { "description": "A message describing the warning, intended to be suitable for display in a user interface.", "readOnly": true, "type": "string" }, "details": { "readOnly": true, "type": "array", "items": { "$ref": "#/definitions/WarningBody" }, "x-ms-identifiers": [] } }, "type": "object" }, "WarningCode": { "readOnly": true, "description": "The type of repository.", "enum": [ "SourceControlWarning_DeleteServicePrincipal", "SourceControlWarning_DeletePipelineFromAzureDevOps", "SourceControlWarning_DeleteWorkflowAndSecretFromGitHub", "SourceControlWarning_DeleteRoleAssignment", "SourceControl_DeletedWithWarnings" ], "type": "string", "x-ms-enum": { "modelAsString": true, "name": "WarningCode", "values": [ { "value": "SourceControlWarning_DeleteServicePrincipal" }, { "value": "SourceControlWarning_DeletePipelineFromAzureDevOps" }, { "value": "SourceControlWarning_DeleteWorkflowAndSecretFromGitHub" }, { "value": "SourceControlWarning_DeleteRoleAssignment" }, { "value": "SourceControl_DeletedWithWarnings" } ] } } }, "parameters": { "RepoTypeParameter": { "description": "The repo type.", "in": "body", "name": "repoType", "required": true, "schema": { "$ref": "#/definitions/RepoType" }, "x-ms-parameter-location": "method" }, "SourceControlIdParameter": { "description": "Source control Id", "in": "path", "name": "sourceControlId", "required": true, "type": "string", "x-ms-parameter-location": "method" }, "SourceControl": { "description": "The SourceControl", "in": "body", "name": "sourceControl", "required": true, "schema": { "$ref": "#/definitions/SourceControl" }, "x-ms-parameter-location": "method" }, "RepositoryAccess": { "description": "The repository access credentials.", "in": "body", "name": "repositoryAccess", "required": true, "schema": { "required": [ "repositoryAccess" ], "$ref": "#/definitions/RepositoryAccessProperties" }, "x-ms-parameter-location": "method" } } }