AzureDevOps
Manage Git repositories in Azure DevOps Services. Integration capabilities include retrieving, creating, and updating pull requests. Run pipelines and retrieve Git information.
Utilities · AzureDevOps
Details
| ID | AzureDevOps |
|---|---|
| Provider | Microsoft |
| Category | Utilities |
| From Version | 6.0.0 |
| Docker Image | demisto/crypto:1.0.0.10120494 |
| Supported Modules | Agentix XSIAM |
README
Azure DevOps
Manage Git repositories in Azure DevOps Services. Integration capabilities include retrieving, creating, and updating pull requests. Run pipelines and retrieve git information.
Configure AzureDevOps in Cortex
| Parameter | Description | Required |
|---|---|---|
| Client ID | App Registration Client ID | True |
| Organization | Organization name | True |
| Maximum incidents for one fetch. | Default is 50. Maximum is 200. | False |
| Pull-request project name | The name of the project which the pull requests belongs to. A project name can be obtained by running the ‘azure-devops-project-list’ command. This argument is mandatory for Fetch functionality. | False |
| Pull-request repository name | The name of the repository pull request’s target branch. A repository name can be obtained by running the ‘azure-devops-repository-list’ command. This argument is mandatory for Fetch functionality. | False |
| Incident type | False | |
| Fetch incidents | False | |
| First fetch timestamp (<number> <time unit>, e.g., 12 hours, 7 days) | False | |
| Outgoing mirroring | False | |
| Use system proxy settings | False | |
| Trust any certificate (not secure) | False | |
| Authentication Type | Type of authentication - could be Authorization Code Flow (recommended), Device Code Flow or Client Credentials Flow. | False |
| Tenant ID | For user-auth mode or client credentials. | False |
| Client Secret | For user-auth mode or client credentials. | False |
| Application redirect URI | For user-auth mode or client credentials. | False |
| Authorization code | for user-auth mode - received from the authorization step. see Detailed Instructions (?) section | False |
In order to connect to the Azure DevOps using the Self-Deployed Azure App, use one of the following methods:
- Authorization Code Flow (Recommended).
- Device Code Flow.
- Client Credentials Flow.
Self-Deployed Azure App
- To use a self-configured Azure application, you need to add a new Azure App Registration in the Azure Portal.
To add the registration, refer to the following Microsoft article steps 1-8. - Add the following permissions to your registered app:
Azure DevOps/user_impersonationMicrosoft Graph/User.Read
To add a permission:
a. Navigate to Azure Portal > **Home > App registrations.
b. Search for your app under ‘all applications’.
c. Click API permissions > Add permission.
d. Search for the specific Microsoft API and select the specific permission of type Delegated.
e. Click Grant admin consent.
- In your registered app - Get the Application (client) ID.
a. In the Azure Portal, navigate to App registrations > your registered application > Overview.
b. Copy and save the Application (client) ID. - In the Client ID parameter, enter your registered app Application (client) ID.
-
In the Organization parameter, enter the Azure DevOps organization name.
More information about creating an organization or project can be found here:
To the Azure DevOps Account, use one of the following flows-
Authorization Code Flow (Recommended)
For a Authorization Code configuration:
- To use a self-configured Azure application, you need to add a new Azure App Registration in the Azure Portal. To add the registration, refer to the following Microsoft article steps 1-8.
- In the Authentication Type field, select the Authorization Code option.
- In the Application ID field, enter your Client/Application ID.
- In the Client Secret field, enter your Client Secret.
- In the Tenant ID field, enter your Tenant ID .
- In the Application redirect URI field, enter your Application redirect URI.
- Save the instance.
- Run the
!azure-devops-generate-login-urlcommand in the War Room and follow the instruction. - Run the !azure-devops-auth-test command - a ‘Success’ message should be printed to the War Room.
Device Code Flow
To use the device authorization grant flow.
- In the Application ID field, enter your Client/Application ID.
- Run the !azure-devops-auth-start command.
- Follow the instructions that appear.
- Run the !azure-devops-auth-complete command.
Client Credentials Flow
Assign Azure roles using the Azure portal Microsoft article
Note: In the Select members section, assign the application you created earlier.
To configure a Microsoft integration that uses this authorization flow with a self-deployed Azure application:
- In the Authentication Type field, select the Client Credentials option.
- In the Application ID field, enter your Client/Application ID.
- In the Tenant ID field, enter your Tenant ID .
- In the Client Secret field, enter your Client Secret.
- Click Test to validate the URLs, token, and connection
- Save the instance.
Testing authentication and connectivity
If you are using Device Code Flow or Authorization Code Flow, for testing your authentication and connectivity to the Azure DevOps service run the !azure-devops-auth-test command.
If you are using Client Credentials Flow, click Test when you are configuring the instance.
Troubleshooting
If you encounter the following error:
Please sign in at least once as {tenant_id}/{application_id} in a web browser to enable access to the service.
Please follow these steps to resolve it:
- Navigate to your Azure DevOps organization using this URL (replace {organization_name} with your actual org name):
https://dev.azure.com/{organization_name} - In the bottom-left corner, click Organization settings.
- Select Users from the left menu.
- Click Add Users.
- In the Users or Service Principals field, paste the Application (Client) ID of your app.
- Assign the appropriate Access Level, at least a basic license, and add any necessary projects.
- Click Add to complete.
- Once added, confirm that the application appears in the Users list.
- Now retry running the failing command.
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
azure-devops-auth-test
Tests the connectivity to Azure.
Base Command
azure-devops-auth-test
Input
There are no input arguments for this command.
Context Output
There is no context output for this command.
Command Example
#### Human Readable Output
>Success!
### azure-devops-generate-login-url
***
Generate the login url used for Authorization code flow.
#### Base Command
`azure-devops-generate-login-url`
#### Input
There are no input arguments for this command.
#### Context Output
There is no context output for this command.
#### Command Example
```azure-devops-generate-login-url```
#### Human Readable Output
>### Authorization instructions
>
>1. Click on the login URL to sign in and grant Cortex XSOAR permissions for your Azure Service Management.
You will be automatically redirected to a link with the following structure:
>```REDIRECT_URI?code=AUTH_CODE&session_state=SESSION_STATE```
>2. Copy the `AUTH_CODE` (without the `“code=”` prefix, and the `session_state` parameter)
and paste it in your instance configuration under the **Authorization code** parameter.
### azure-devops-auth-start
***
Run this command to start the authorization process and follow the instructions in the command results.
#### Base Command
`azure-devops-auth-start`
#### Input
There are no input arguments for this command.
#### Context Output
There is no context output for this command.
#### Command Example
```!azure-devops-auth-start```
#### Human Readable Output
>### Authorization instructions
>
>1. To sign in, use a web browser to open the page [https://microsoft.com/devicelogin](https://microsoft.com/devicelogin)
>and enter the code *XXXX** to authenticate.
>2. Run the **!azure-devops-auth-complete** command in the War Room.
### azure-devops-auth-complete
***
Run this command to complete the authorization process. Should be used after running the azure-devops-auth-start command.
#### Base Command
`azure-devops-auth-complete`
#### Input
There are no input arguments for this command.
#### Context Output
There is no context output for this command.
#### Command Example
```!azure-devops-auth-complete```
#### Human Readable Output
>Authorization completed successfully.
### azure-devops-auth-reset
***
Run this command if for some reason you need to rerun the authentication process.
#### Base Command
`azure-devops-auth-reset`
#### Input
There are no input arguments for this command.
#### Context Output
There is no context output for this command.
#### Command Example
```!azure-devops-auth-reset```
#### Human Readable Output
>Authorization was reset successfully. Run **!azure-devops-auth-start** to start the authentication process.
### get-mapping-fields
***
Get mapping fields from remote incident. Please note that this method will not update the current incident. It's here for debugging purposes.
#### Base Command
`get-mapping-fields`
#### Input
There are no input arguments for this command.
#### Context Output
There is no context output for this command.
#### Command Example
Human Readable Output
azure-devops-pipeline-run
Run a pipeline. A DevOps pipeline is a set of automated processes and tools that allows both developers and operations professionals to work cohesively to build and deploy code to a production environment.
Base Command
azure-devops-pipeline-run
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name of the project. | Required |
| pipeline_id | The ID of the pipeline. | Required |
| branch_name | The name of the repository branch which runs the pipeline. | Required |
| polling | Use Cortex XSOAR built-in polling to retrieve the result when it’s ready. Possible values are: True, False. Default is False. | Optional |
| interval | Indicates how long to wait between command execution (in seconds) when ‘polling’ argument is true. Minimum value is 10 seconds. Default is 30. | Optional |
| timeout | Indicates the time in seconds until the polling sequence timeouts. Default is 60. | Optional |
| run_id | The ID of the pipeline run to retrieve when polling argument is ‘True’. Intended for use by the Polling process and does not need to be provided by the user. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PipelineRun.project | String | The name of the project. |
| AzureDevOps.PipelineRun.pipeline.id | Number | The ID of the pipeline. |
| AzureDevOps.PipelineRun.pipeline.name | String | The pipeline repository name. |
| AzureDevOps.PipelineRun.state | String | The run state. |
| AzureDevOps.PipelineRun.createdDate | Date | The run creation date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PipelineRun.run_id | Number | The ID of the run. |
| AzureDevOps.PipelineRun.name | String | The name of the run. |
| AzureDevOps.PipelineRun.result | String | The result of the pipeline running. If the run is in progress, the default value is ‘unknown’. |
Command Example
!azure-devops-pipeline-run project="xsoar" pipeline_id="1" branch_name="main"
Context Example
{
"AzureDevOps": {
"PipelineRun": {
"_links": {
"pipeline": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1?revision=1"
},
"pipeline.web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/definition?definitionId=1"
},
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1/runs/1154"
},
"web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/results?buildId=1154"
}
},
"createdDate": "2021-11-30T08:57:03.110121+00:00",
"name": "20211130.1",
"pipeline": {
"folder": "\\",
"id": 1,
"name": "xsoar",
"revision": 1,
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1?revision=1"
},
"project": "xsoar",
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/main",
"repository": {
"id": "XXXX",
"type": "azureReposGit"
},
"version": "2eca089fab76f1f32051d188653ea7d279b90a4b"
}
}
},
"result": "unknown",
"run_id": 1154,
"state": "inProgress",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1/runs/1154"
}
}
}
Human Readable Output
Pipeline Run Information
Pipeline Id Run State Creation Date Run Id Result 1 inProgress 2021-11-30T08:57:03.110121+00:00 1154 unknown
azure-devops-user-add
Add a user, assign the user a license and extensions, and make the user a member of a project group in an account.
Base Command
azure-devops-user-add
Input
| Argument Name | Description | Required |
|---|---|---|
| user_email | The email address of the user to add to the organization. | Required |
| account_license_type | The type of account license. More information can be found here: https://docs.microsoft.com/en-us/rest/api/azure/devops/memberentitlementmanagement/user-entitlements/add?view=azure-devops-rest-6.1#accountlicensetype. Possible values are: express, stakeholder, advanced, earlyAdopter, professional. | Required |
| group_type | The project group type. More information can be found here: https://docs.microsoft.com/en-us/rest/api/azure/devops/memberentitlementmanagement/user-entitlements/add?view=azure-devops-rest-6.1#grouptype. Possible values are: projectReader, projectContributor, projectAdministrator, projectStakeholder. | Required |
| project_id | The ID of the project. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.User.id | String | The ID of the user. |
Command Example
!azure-devops-user-add user_email="user1@xsoar.com" account_license_type="express" group_type="projectContributor" project_id="xsoar-project"
Context Example
{
"AzureDevOps": {
"User": {
"accessLevel": {
"accountLicenseType": "express",
"assignmentSource": "unknown",
"licenseDisplayName": "Basic",
"licensingSource": "account",
"msdnLicenseType": "none",
"status": "pending",
"statusMessage": ""
},
"dateCreated": "2021-11-29T09:05:26.9223894Z",
"extensions": [],
"groupAssignments": [],
"id": "XXXX",
"lastAccessedDate": "0001-01-01T00:00:00Z",
"projectEntitlements": [],
"user": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3"
},
"membershipState": {
"href": "https://vssps.dev.azure.com/xsoar-organization/_apis/Graph/MembershipStates/aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3"
},
"memberships": {
"href": "https://vssps.dev.azure.com/xsoar-organization/_apis/Graph/Memberships/aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3"
},
"self": {
"href": "https://vssps.dev.azure.com/xsoar-organization/_apis/Graph/Users/aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3"
},
"storageKey": {
"href": "https://vssps.dev.azure.com/xsoar-organization/_apis/Graph/StorageKeys/aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3"
}
},
"descriptor": "aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3",
"directoryAlias": "User 1",
"displayName": "XSOAR User 2",
"domain": "XXXX",
"mailAddress": "user1@xsoar.com",
"metaType": "member",
"origin": "aad",
"originId": "2c7514ff-41d0-4eb0-ac82-35b8671de094",
"principalName": "user1@xsoar.com",
"subjectKind": "user",
"url": "https://vssps.dev.azure.com/xsoar-organization/_apis/Graph/Users/aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3"
}
}
}
}
Human Readable Output
User Information
Id Account License Type Last Accessed Date XXXX express 0001-01-01T00:00:00Z
azure-devops-user-remove
Remove the user from all project memberships.
Base Command
azure-devops-user-remove
Input
| Argument Name | Description | Required |
|---|---|---|
| user_id | The ID of the user to be removed from the organization. A user ID can be obtained by running the ‘azure-devops-user-list’ command. | Required |
Context Output
There is no context output for this command.
Command Example
!azure-devops-user-remove user_id="XXXX"
Human Readable Output
User XXXX was successfully removed from the organization.
azure-devops-pull-request-create
Create a new pull request.
Base Command
azure-devops-pull-request-create
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name or ID of the project. | Required |
| repository_id | The repository ID of the pull request’s target branch. A repository ID can be obtained by running the ‘azure-devops-repository-list’ command. | Required |
| source_branch | The name of the source branch of the pull request. | Required |
| target_branch | The name of the target branch of the pull request. | Required |
| title | The title of the pull request. | Required |
| description | The description of the pull request. | Required |
| reviewers_ids | Comma-separated list of the pull request reviewers IDs. A reviewer ID can be obtained by running the ‘azure-devops-user-list’ command. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequest.repository.project.name | String | The name of the project. |
| AzureDevOps.PullRequest.repository.id | String | The ID of the repository. |
| AzureDevOps.PullRequest.repository.name | String | The name of the repository. |
| AzureDevOps.PullRequest.repository.url | String | The URL of the repository. |
| AzureDevOps.PullRequest.repository.size | Number | The size of the repository. |
| AzureDevOps.PullRequest.pullRequestId | Number | The ID of the pull request. |
| AzureDevOps.PullRequest.status | String | The status of the pull request. |
| AzureDevOps.PullRequest.createdBy.displayName | String | The display name of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.id | String | The ID of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.uniqueName | String | The unique name of the pull request creator. |
| AzureDevOps.PullRequest.creationDate | Date | The creation date of the pull request, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PullRequest.title | String | The title of the pull request |
| AzureDevOps.PullRequest.description | String | The description of the pull request. |
| AzureDevOps.PullRequest.sourceRefName | String | The source branch of the pull request. |
| AzureDevOps.PullRequest.targetRefName | String | The target branch of the pull request. |
| AzureDevOps.PullRequest.mergeStatus | String | The current status of the pull request merge. |
| AzureDevOps.PullRequest.isDraft | Boolean | Whether the pull request is a draft / WIP. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.commitId | String | The ID of the commit at the head of the source branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.url | String | The REST URL for this resource. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.commitId | String | The ID of the commit at the head of the target branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.url | String | The REST URL for this resource. |
Command Example
!azure-devops-pull-request-create project="xsoar" repository_id="XXXX" source_branch="test-test" target_branch="main" title="Test xsoar" description="Demo pr" reviewers_ids="XXXX"
Context Example
{
"AzureDevOps": {
"PullRequest": {
"_links": {
"createdBy": {
"href": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"iterations": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/iterations"
},
"repository": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX"
},
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
},
"sourceBranch": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs/heads/test-test"
},
"sourceCommit": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"statuses": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/statuses"
},
"targetBranch": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs/heads/main"
},
"targetCommit": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"workItems": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/workitems"
}
},
"artifactId": "vstfs:///Git/PullRequestId/xsoar-project%2fXXXX%2f70",
"codeReviewId": 70,
"createdBy": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"descriptor": "aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5",
"displayName": "XSOAR User 1",
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"creationDate": "2021-11-30T08:56:55.531709+00:00",
"description": "Demo pr",
"isDraft": false,
"labels": [],
"lastMergeSourceCommit": {
"commitId": "b21e2330a6ae2f920b8f5ae9b74e069230b27087",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"lastMergeTargetCommit": {
"commitId": "2eca089fab76f1f32051d188653ea7d279b90a4b",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"mergeId": "a950a614-1a14-4412-90ad-e6f7417e26c6",
"mergeStatus": "queued",
"pullRequestId": 70,
"repository": {
"id": "XXXX",
"isDisabled": false,
"name": "xsoar",
"project": {
"id": "xsoar-project",
"lastUpdateTime": "2021-10-13T15:46:18.017Z",
"name": "xsoar",
"revision": 11,
"state": "wellFormed",
"url": "https://dev.azure.com/xsoar-organization/_apis/projects/xsoar-project",
"visibility": "private"
},
"remoteUrl": "https://xsoar-organization@dev.azure.com/xsoar-organization/xsoar/_git/xsoar",
"size": 12366,
"sshUrl": "git@ssh.dev.azure.com:v3/xsoar-organization/xsoar/xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX",
"webUrl": "https://dev.azure.com/xsoar-organization/xsoar/_git/xsoar"
},
"reviewers": [
{
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"displayName": "XSOAR User 1",
"hasDeclined": false,
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"isFlagged": false,
"reviewerUrl": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/reviewers/XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX",
"vote": 0
}
],
"sourceRefName": "refs/heads/test-test",
"status": "active",
"supportsIterations": true,
"targetRefName": "refs/heads/main",
"title": "Test xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
}
}
}
Human Readable Output
Pull Request Information
Title Description Created By Pull Request Id Repository Name Repository Id Project Name Project Id Creation Date Test xsoar Demo pr XSOAR User 1 70 xsoar XXXX xsoar xsoar-project 2021-11-30T08:56:55
azure-devops-pull-request-update
Update a pull request. At least one of the following arguments must be provided: title, description, or status.
Base Command
azure-devops-pull-request-update
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name or ID of the project. | Required |
| repository_id | The repository ID of the pull request’s target branch. A repository ID can be obtained by running the ‘azure-devops-repository-list’ command. | Required |
| pull_request_id | The ID of the pull request to update. | Required |
| title | The updated pull-request title. | Optional |
| description | The updated pull-request description. | Optional |
| status | The updated pull-request status. Possible values are: abandoned, completed, active. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequest.repository.project.name | String | The name of the project. |
| AzureDevOps.PullRequest.repository.id | String | The ID of the repository. |
| AzureDevOps.PullRequest.repository.name | String | The name of the repository. |
| AzureDevOps.PullRequest.repository.url | String | The URL of the repository. |
| AzureDevOps.PullRequest.repository.size | Number | The size of the repository. |
| AzureDevOps.PullRequest.pullRequestId | Number | The ID of the pull request. |
| AzureDevOps.PullRequest.status | String | The status of the pull request. |
| AzureDevOps.PullRequest.createdBy.displayName | String | The display name of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.id | String | The ID of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.uniqueName | String | The unique name of the pull request creator. |
| AzureDevOps.PullRequest.creationDate | Date | The creation date of the pull request, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PullRequest.title | String | The title of the pull request |
| AzureDevOps.PullRequest.description | String | The description of the pull request. |
| AzureDevOps.PullRequest.sourceRefName | String | The source branch of the pull request. |
| AzureDevOps.PullRequest.targetRefName | String | The target branch of the pull request. |
| AzureDevOps.PullRequest.mergeStatus | String | The current status of the pull request merge. |
| AzureDevOps.PullRequest.isDraft | Boolean | Whether the pull request is a draft / WIP. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.commitId | String | The ID of the commit at the head of the source branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.url | String | The REST URL for this resource. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.commitId | String | The ID of the commit at the head of the target branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.url | String | The REST URL for this resource. |
Command Example
!azure-devops-pull-request-update project="xsoar" repository_id="XXXX" pull_request_id="70" title="New title"
Context Example
{
"AzureDevOps": {
"PullRequest": {
"_links": {
"createdBy": {
"href": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"iterations": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/iterations"
},
"repository": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX"
},
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
},
"sourceBranch": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs/heads/test-test"
},
"sourceCommit": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"statuses": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/statuses"
},
"targetBranch": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs/heads/main"
},
"targetCommit": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"workItems": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/workitems"
}
},
"artifactId": "vstfs:///Git/PullRequestId/xsoar-project%2fXXXX%2f70",
"codeReviewId": 70,
"createdBy": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"descriptor": "aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5",
"displayName": "XSOAR User 1",
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"creationDate": "2021-11-30T08:56:55.531709+00:00",
"description": "Demo pr",
"isDraft": false,
"lastMergeCommit": {
"author": {
"date": "2021-11-30T08:56:55Z",
"email": "user2@xsoar.com",
"name": "XSOAR User 1"
},
"comment": "Merge pull request 70 from test-test into main",
"commitId": "333b2ec34ca6b330901af84a2483c87effb49c23",
"committer": {
"date": "2021-11-30T08:56:55Z",
"email": "user2@xsoar.com",
"name": "XSOAR User 1"
},
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/333b2ec34ca6b330901af84a2483c87effb49c23"
},
"lastMergeSourceCommit": {
"commitId": "b21e2330a6ae2f920b8f5ae9b74e069230b27087",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"lastMergeTargetCommit": {
"commitId": "2eca089fab76f1f32051d188653ea7d279b90a4b",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"mergeId": "a950a614-1a14-4412-90ad-e6f7417e26c6",
"mergeStatus": "succeeded",
"pullRequestId": 70,
"repository": {
"id": "XXXX",
"isDisabled": false,
"name": "xsoar",
"project": {
"id": "xsoar-project",
"lastUpdateTime": "2021-10-13T15:46:18.017Z",
"name": "xsoar",
"revision": 11,
"state": "wellFormed",
"url": "https://dev.azure.com/xsoar-organization/_apis/projects/xsoar-project",
"visibility": "private"
},
"remoteUrl": "https://xsoar-organization@dev.azure.com/xsoar-organization/xsoar/_git/xsoar",
"size": 12366,
"sshUrl": "git@ssh.dev.azure.com:v3/xsoar-organization/xsoar/xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX",
"webUrl": "https://dev.azure.com/xsoar-organization/xsoar/_git/xsoar"
},
"reviewers": [
{
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"displayName": "XSOAR User 1",
"hasDeclined": false,
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"isFlagged": false,
"reviewerUrl": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/reviewers/XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX",
"vote": 0
}
],
"sourceRefName": "refs/heads/test-test",
"status": "active",
"supportsIterations": true,
"targetRefName": "refs/heads/main",
"title": "New title",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
}
}
}
Human Readable Output
Pull Request Information
Title Description Created By Pull Request Id Repository Name Repository Id Project Name Project Id Creation Date New title Demo pr XSOAR User 1 70 xsoar XXXX xsoar xsoar-project 2021-11-30T08:56:55
azure-devops-pull-request-list
Retrieve pull requests in repository.
Base Command
azure-devops-pull-request-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name or ID of the project which the pull requests belongs to. | Required |
| repository | The name of the repository pull request’s target branch. | Required |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequest.repository.project.name | String | The name of the project. |
| AzureDevOps.PullRequest.repository.id | String | The ID of the repository. |
| AzureDevOps.PullRequest.repository.name | String | The name of the repository. |
| AzureDevOps.PullRequest.repository.url | String | The URL of the repository. |
| AzureDevOps.PullRequest.pullRequestId | Number | The ID of the pull request. |
| AzureDevOps.PullRequest.status | String | The status of the pull request. |
| AzureDevOps.PullRequest.createdBy.displayName | String | The display name of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.id | String | The ID of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.uniqueName | String | The unique name of the pull request creator. |
| AzureDevOps.PullRequest.creationDate | Date | The creation date of the pull request, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PullRequest.title | String | The title of the pull request |
| AzureDevOps.PullRequest.description | String | The description of the pull request. |
| AzureDevOps.PullRequest.sourceRefName | String | The source branch of the pull request. |
| AzureDevOps.PullRequest.targetRefName | String | The target branch of the pull request. |
| AzureDevOps.PullRequest.mergeStatus | String | The current status of the pull request merge. |
| AzureDevOps.PullRequest.isDraft | Boolean | Whether the pull request is a draft / WIP. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.commitId | String | The ID of the commit at the head of the source branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.url | String | The REST URL for this resource. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.commitId | String | The ID of the commit at the head of the target branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.url | String | The REST URL for this resource. |
Command Example
!azure-devops-pull-request-list project="xsoar" repository="xsoar" page="1" limit="2"
Context Example
{
"AzureDevOps": {
"PullRequest": [
{
"codeReviewId": 70,
"createdBy": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"descriptor": "aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5",
"displayName": "XSOAR User 1",
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"creationDate": "2021-11-30T08:56:55.531709+00:00",
"description": "Demo pr",
"isDraft": false,
"lastMergeCommit": {
"commitId": "333b2ec34ca6b330901af84a2483c87effb49c23",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/333b2ec34ca6b330901af84a2483c87effb49c23"
},
"lastMergeSourceCommit": {
"commitId": "b21e2330a6ae2f920b8f5ae9b74e069230b27087",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"lastMergeTargetCommit": {
"commitId": "2eca089fab76f1f32051d188653ea7d279b90a4b",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"mergeId": "a950a614-1a14-4412-90ad-e6f7417e26c6",
"mergeStatus": "succeeded",
"pullRequestId": 70,
"repository": {
"id": "XXXX",
"name": "xsoar",
"project": {
"id": "xsoar-project",
"lastUpdateTime": "0001-01-01T00:00:00",
"name": "xsoar",
"state": "unchanged",
"visibility": "unchanged"
},
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX"
},
"reviewers": [
{
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"displayName": "XSOAR User 1",
"hasDeclined": false,
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"isFlagged": false,
"reviewerUrl": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/reviewers/XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX",
"vote": 0
}
],
"sourceRefName": "refs/heads/test-test",
"status": "active",
"supportsIterations": true,
"targetRefName": "refs/heads/main",
"title": "Test xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
},
{
"codeReviewId": 65,
"createdBy": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"descriptor": "aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5",
"displayName": "XSOAR User 1",
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"creationDate": "2021-11-28T16:08:09.172985+00:00",
"description": "Demo pr",
"isDraft": false,
"lastMergeCommit": {
"commitId": "62d2b76a5479406cdfba377f041fed7bb621ccf7",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/62d2b76a5479406cdfba377f041fed7bb621ccf7"
},
"lastMergeSourceCommit": {
"commitId": "738ab51bc619423969314de9bb93373bfb6ae101",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/738ab51bc619423969314de9bb93373bfb6ae101"
},
"lastMergeTargetCommit": {
"commitId": "2eca089fab76f1f32051d188653ea7d279b90a4b",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"mergeId": "46bd552a-8a93-45bb-82ae-4c108020ca15",
"mergeStatus": "succeeded",
"pullRequestId": 65,
"repository": {
"id": "XXXX",
"name": "xsoar",
"project": {
"id": "xsoar-project",
"lastUpdateTime": "0001-01-01T00:00:00",
"name": "xsoar",
"state": "unchanged",
"visibility": "unchanged"
},
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX"
},
"reviewers": [
{
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"displayName": "XSOAR User 1",
"hasDeclined": false,
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"isFlagged": false,
"reviewerUrl": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/65/reviewers/XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX",
"vote": 0
}
],
"sourceRefName": "refs/heads/xsoar-test",
"status": "active",
"supportsIterations": true,
"targetRefName": "refs/heads/main",
"title": "Test xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/65"
}
]
}
}
Human Readable Output
Pull Request List
Current page size: 2
Showing page 1 out others that may exist.
Title Description Created By Pull Request Id Repository Name Repository Id Project Name Project Id Creation Date Test xsoar Demo pr XSOAR User 1 70 xsoar XXXX xsoar xsoar-project 2021-11-30T08:56:55 Test xsoar Demo pr XSOAR User 1 65 xsoar XXXX xsoar xsoar-project 2021-11-28T16:08:09
azure-devops-project-list
Retrieve all projects in the organization that the authenticated user has access to.
Base Command
azure-devops-project-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Project.name | String | The name of the project. |
| AzureDevOps.Project.state | String | The state of the project. |
| AzureDevOps.Project.revision | Number | The revision number of the project. |
| AzureDevOps.Project.visibility | String | Indicates whom the project is visible to. |
| AzureDevOps.Project.lastUpdateTime | Date | The project last update time, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.Project.id | String | The ID of the Project. |
Command Example
!azure-devops-project-list page="1" limit="50"
Context Example
{
"AzureDevOps": {
"Project": [
{
"id": "xsoar-project",
"lastUpdateTime": "2021-10-13T15:46:18.017000+00:00",
"name": "xsoar",
"revision": 11,
"state": "wellFormed",
"url": "https://dev.azure.com/xsoar-organization/_apis/projects/xsoar-project",
"visibility": "private"
}
]
}
}
Human Readable Output
Project List
Current page size: 50
Showing page 1 out others that may exist.
Name Id State Revision Visibility Last Update Time xsoar xsoar-project wellFormed 11 private 2021-10-13T15:46:18.017000+00:00
azure-devops-repository-list
Retrieve git repositories in the organization project.
Base Command
azure-devops-repository-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name or ID of the project to which the repositories belong to. | Required |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Project.name | String | The name of the project. |
| AzureDevOps.Repository.id | String | The ID of the repository. |
| AzureDevOps.Repository.name | String | The name of the repository. |
| AzureDevOps.Repository.webUrl | String | The web URL of the repository. |
| AzureDevOps.Repository.size | Number | The size of the repository (in bytes). |
Command Example
!azure-devops-repository-list project="xsoar" limit="1" page="1"
Context Example
{
"AzureDevOps": {
"Repository": {
"id": "xsoar-repository",
"isDisabled": false,
"name": "test2803",
"project": {
"id": "xsoar-project",
"lastUpdateTime": "2021-10-13T15:46:18.017Z",
"name": "xsoar",
"revision": 11,
"state": "wellFormed",
"url": "https://dev.azure.com/xsoar-organization/_apis/projects/xsoar-project",
"visibility": "private"
},
"remoteUrl": "https://xsoar-organization@dev.azure.com/xsoar-organization/xsoar/_git/test2803",
"size": 0,
"sshUrl": "git@ssh.dev.azure.com:v3/xsoar-organization/xsoar/test2803",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/xsoar-repository",
"webUrl": "https://dev.azure.com/xsoar-organization/xsoar/_git/test2803"
}
}
}
Human Readable Output
Repositories List
Current page size: 1
Showing page 1 out others that may exist.
Id Name Web Url Size ( Bytes ) xsoar-repository test2803 https://dev.azure.com/xsoar-organization/xsoar/_git/test2803 0
azure-devops-user-list
Query users that were added to organization projects.
Base Command
azure-devops-user-list
Input
| Argument Name | Description | Required |
|---|---|---|
| query | Users or organization query prefix. For example, if you want to retrieve information about the user ‘Tom’, you can enter the value of this argument as ‘Tom’. | Required |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.User.entityType | String | The type of the entity. |
| AzureDevOps.User.localId | String | The ID of the identity. |
| AzureDevOps.User.signInAddress | String | The email address of the user. |
Command Example
!azure-devops-user-list query="ofek"
Context Example
{
"AzureDevOps": {
"User": [
{
"active": true,
"department": null,
"description": null,
"displayName": "XSOAR User 2",
"entityId": "vss.ds.v1.aad.user.2c7514ff41d04eb0ac8235b8671de094",
"entityType": "User",
"guest": false,
"isMru": false,
"jobTitle": null,
"localDirectory": "vsd",
"localId": "XXXX",
"mail": "user1@xsoar.com",
"mailNickname": "User 1",
"originDirectory": "aad",
"originId": "2c7514ff-41d0-4eb0-ac82-35b8671de094",
"physicalDeliveryOfficeName": null,
"samAccountName": "user1@xsoar.com",
"scopeName": "Palo Alto Networks",
"signInAddress": "user1@xsoar.com",
"subjectDescriptor": "aad.NWYyZWMzNTctMjgzMS03M2I4LTk1NWYtMmRkZGM2OWVmMzg3",
"surname": "User 1",
"telephoneNumber": null
}
]
}
}
Human Readable Output
Users List
Current page size: 50
Showing page 1 out others that may exist.
Entity Type Id user1@xsoar.com User XXXX user2@xsoar.com User XXXX
azure-devops-pull-request-get
Retrieve pull-request.
Base Command
azure-devops-pull-request-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name or ID of the project. | Required |
| repository_id | The repository ID of the pull request’s target branch. A repository ID can be obtained by running the ‘azure-devops-repository-list’ command. | Required |
| pull_request_id | The ID of the pull request to retrieve. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequest.repository.project.name | String | The name of the project. |
| AzureDevOps.PullRequest.repository.id | String | The ID of the repository. |
| AzureDevOps.PullRequest.repository.name | String | The name of the repository. |
| AzureDevOps.PullRequest.repository.url | String | The URL of the repository. |
| AzureDevOps.PullRequest.repository.size | Number | The size of the repository. |
| AzureDevOps.PullRequest.pullRequestId | Number | The ID of the pull request. |
| AzureDevOps.PullRequest.status | String | The status of the pull request. |
| AzureDevOps.PullRequest.createdBy.displayName | String | The display name of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.id | String | The ID of the pull request creator. |
| AzureDevOps.PullRequest.createdBy.uniqueName | String | The unique name of the pull request creator. |
| AzureDevOps.PullRequest.creationDate | Date | The creation date of the pull request, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PullRequest.title | String | The title of the pull request |
| AzureDevOps.PullRequest.description | String | The description of the pull request. |
| AzureDevOps.PullRequest.sourceRefName | String | The source branch of the pull request. |
| AzureDevOps.PullRequest.targetRefName | String | The target branch of the pull request. |
| AzureDevOps.PullRequest.mergeStatus | String | The current status of the pull request merge. |
| AzureDevOps.PullRequest.isDraft | Boolean | Whether the pull request is a draft / WIP. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.commitId | String | The ID of the commit at the head of the source branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeSourceCommit.url | String | The REST URL for the merge source commit. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.commitId | String | The ID of the commit at the head of the target branch at the time of the last pull request merge. |
| AzureDevOps.PullRequest.lastMergeTargetCommit.url | String | The REST URL for the merge target commit. |
Command Example
!azure-devops-pull-request-get project="xsoar" repository_id="XXXX" pull_request_id="70"
Context Example
{
"AzureDevOps": {
"PullRequest": {
"_links": {
"createdBy": {
"href": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"iterations": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/iterations"
},
"repository": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX"
},
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
},
"sourceBranch": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs/heads/test-test"
},
"sourceCommit": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"statuses": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/statuses"
},
"targetBranch": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs/heads/main"
},
"targetCommit": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"workItems": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/workitems"
}
},
"artifactId": "vstfs:///Git/PullRequestId/xsoar-project%2fXXXX%2f70",
"codeReviewId": 70,
"createdBy": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"descriptor": "aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5",
"displayName": "XSOAR User 1",
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"creationDate": "2021-11-30T08:56:55.531709+00:00",
"description": "Demo pr",
"isDraft": false,
"lastMergeCommit": {
"author": {
"date": "2021-11-30T08:56:55Z",
"email": "user2@xsoar.com",
"name": "XSOAR User 1"
},
"comment": "Merge pull request 70 from test-test into main",
"commitId": "333b2ec34ca6b330901af84a2483c87effb49c23",
"committer": {
"date": "2021-11-30T08:56:55Z",
"email": "user2@xsoar.com",
"name": "XSOAR User 1"
},
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/333b2ec34ca6b330901af84a2483c87effb49c23"
},
"lastMergeSourceCommit": {
"commitId": "b21e2330a6ae2f920b8f5ae9b74e069230b27087",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/b21e2330a6ae2f920b8f5ae9b74e069230b27087"
},
"lastMergeTargetCommit": {
"commitId": "2eca089fab76f1f32051d188653ea7d279b90a4b",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/commits/2eca089fab76f1f32051d188653ea7d279b90a4b"
},
"mergeId": "a950a614-1a14-4412-90ad-e6f7417e26c6",
"mergeStatus": "succeeded",
"pullRequestId": 70,
"repository": {
"id": "XXXX",
"isDisabled": false,
"name": "xsoar",
"project": {
"id": "xsoar-project",
"lastUpdateTime": "2021-10-13T15:46:18.017Z",
"name": "xsoar",
"revision": 11,
"state": "wellFormed",
"url": "https://dev.azure.com/xsoar-organization/_apis/projects/xsoar-project",
"visibility": "private"
},
"remoteUrl": "https://xsoar-organization@dev.azure.com/xsoar-organization/xsoar/_git/xsoar",
"size": 12366,
"sshUrl": "git@ssh.dev.azure.com:v3/xsoar-organization/xsoar/xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX",
"webUrl": "https://dev.azure.com/xsoar-organization/xsoar/_git/xsoar"
},
"reviewers": [
{
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"displayName": "XSOAR User 1",
"hasDeclined": false,
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"isFlagged": false,
"reviewerUrl": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70/reviewers/XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX",
"vote": 0
}
],
"sourceRefName": "refs/heads/test-test",
"status": "active",
"supportsIterations": true,
"targetRefName": "refs/heads/main",
"title": "Test xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/pullRequests/70"
}
}
}
Human Readable Output
Pull Request Information
Title Description Created By Pull Request Id Repository Name Repository Id Project Name Project Id Creation Date Test xsoar Demo pr XSOAR User 1 70 xsoar XXXX xsoar xsoar-project 2021-11-30T08:56:55
azure-devops-pipeline-run-get
Retrieve information for a pipeline run.
Base Command
azure-devops-pipeline-run-get
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name of the project. | Required |
| pipeline_id | The ID of the pipeline to retrieve. | Required |
| run_id | The ID of the pipeline run to retrieve. | Required |
| scheduled | Indicates if the command was scheduled. Possible values are: True, False. Default is False. | Optional |
| interval | Indicates how long to wait between command execution (in seconds) when ‘polling’ argument is true. Minimum value is 10 seconds. Default is 30. | Optional |
| timeout | Indicates the time in seconds until the polling sequence timeouts. Default is 60. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PipelineRun.project | String | The name of the project. |
| AzureDevOps.PipelineRun.pipeline.id | Number | The ID of the pipeline. |
| AzureDevOps.PipelineRun.pipeline.name | String | Pipeline repository name. |
| AzureDevOps.PipelineRun.state | String | The run state. |
| AzureDevOps.PipelineRun.createdDate | Date | The run creation date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PipelineRun.run_id | Number | The ID of the run. |
| AzureDevOps.PipelineRun.name | String | The name of the run. |
| AzureDevOps.PipelineRun.result | String | The result of the pipeline running. If the run is in progress, the default value is ‘unknown’. |
Command Example
!azure-devops-pipeline-run-get project="xsoar" pipeline_id="1" run_id="114"
Context Example
{
"AzureDevOps": {
"PipelineRun": {
"_links": {
"pipeline": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1?revision=1"
},
"pipeline.web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/definition?definitionId=1"
},
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1/runs/114"
},
"web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/results?buildId=114"
}
},
"createdDate": "2021-11-07T08:09:03.592213+00:00",
"finishedDate": "2021-11-07T08:09:28.3447367Z",
"name": "20211107.1",
"pipeline": {
"folder": "\\",
"id": 1,
"name": "xsoar",
"revision": 1,
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1?revision=1"
},
"project": "xsoar",
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/main",
"repository": {
"id": "XXXX",
"type": "azureReposGit"
},
"version": "2eca089fab76f1f32051d188653ea7d279b90a4b"
}
}
},
"result": "failed",
"run_id": 114,
"state": "completed",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1/runs/114"
}
}
}
Human Readable Output
Pipeline Run Information
Pipeline Id Run State Creation Date Run Id Result 1 completed 2021-11-07T08:09:03.592213+00:00 114 failed
azure-devops-pipeline-run-list
Retrieve pipeline runs list. The command retrieves up to the top 10000 runs for a particular pipeline.
Base Command
azure-devops-pipeline-run-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name of the organization project. | Required |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
| pipeline_id | The ID of the pipeline which the runs belongs to. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PipelineRun.project | String | The name of the project. |
| AzureDevOps.PipelineRun.pipeline.id | Number | The ID of the pipeline. |
| AzureDevOps.PipelineRun.pipeline.name | String | Pipeline repository name |
| AzureDevOps.PipelineRun.state | String | The run state. |
| AzureDevOps.PipelineRun.createdDate | Date | The run creation date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.PipelineRun.run_id | Number | The ID of the run. |
| AzureDevOps.PipelineRun.name | String | The name of the run. |
| AzureDevOps.PipelineRun.result | String | The result of the pipeline running. If the run is in progress, the default value is ‘unknown’. |
Command Example
!azure-devops-pipeline-run-list project="xsoar" page="1" limit="1" pipeline_id="1"
Context Example
{
"AzureDevOps": {
"PipelineRun": {
"_links": {
"pipeline": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1?revision=1"
},
"pipeline.web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/definition?definitionId=1"
},
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1/runs/1154"
},
"web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/results?buildId=1154"
}
},
"createdDate": "2021-11-30T08:57:03.110121+00:00",
"name": "20211130.1",
"pipeline": {
"folder": "\\",
"id": 1,
"name": "xsoar",
"revision": 1,
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1?revision=1"
},
"project": "xsoar",
"result": "unknown",
"run_id": 1154,
"state": "inProgress",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/1/runs/1154"
}
}
}
Human Readable Output
Pipeline runs List
Current page size: 1
Showing page 1 out others that may exist.
Pipeline Id Run State Creation Date Run Id Result 1 inProgress 2021-11-30T08:57:03.110121+00:00 1154 unknown
azure-devops-pipeline-list
Retrieve project pipelines list.
Base Command
azure-devops-pipeline-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name of the organization project. | Required |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Pipeline.project | String | The name of the project. |
| AzureDevOps.Pipeline.id | Number | The ID of the pipeline. |
| AzureDevOps.Pipeline.revision | Number | Pipeline revision number. |
| AzureDevOps.Pipeline.name | String | Pipeline name. |
| AzureDevOps.Pipeline.folder | String | Pipeline folder. |
Command Example
!azure-devops-pipeline-list project="xsoar" page="1" limit="1"
Context Example
{
"AzureDevOps": {
"Pipeline": {
"_links": {
"self": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/2?revision=1"
},
"web": {
"href": "https://dev.azure.com/xsoar-organization/xsoar-project/_build/definition?definitionId=2"
}
},
"folder": "\\",
"id": 2,
"name": "xsoar (1)",
"project": "xsoar",
"revision": 1,
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/pipelines/2?revision=1"
}
}
}
Human Readable Output
Pipelines List
Current page size: 1
Showing page 1 out others that may exist.
Id Name Revision Folder 2 xsoar (1) 1 \
azure-devops-branch-list
Retrieve repository branches list.
Base Command
azure-devops-branch-list
Input
| Argument Name | Description | Required |
|---|---|---|
| project | The name of the organization project. | Required |
| repository | The name of the project repository. | Required |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Branch.project | String | The name of the project. |
| AzureDevOps.Branch.repository | String | The name of the repository. |
| AzureDevOps.Branch.name | String | The name of the branch. |
Command Example
!azure-devops-branch-list project="xsoar" repository="xsoar" page="1" limit="1"
Context Example
{
"AzureDevOps": {
"Branch": {
"creator": {
"_links": {
"avatar": {
"href": "https://dev.azure.com/xsoar-organization/_apis/GraphProfile/MemberAvatars/aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5"
}
},
"descriptor": "aad.ZWFlMjk2ZGYtMzYwOS03YWY3LWFkNzMtYzNlYmRhZDM3ZmQ5",
"displayName": "XSOAR User 1",
"id": "XXXX",
"imageUrl": "https://dev.azure.com/xsoar-organization/_api/_common/identityImage?id=XXXX",
"uniqueName": "user2@xsoar.com",
"url": "https://vssps.visualstudio.com/XXXX/_apis/Identities/XXXX"
},
"name": "refs/heads/main",
"objectId": "2eca089fab76f1f32051d188653ea7d279b90a4b",
"project": "xsoar",
"repository": "xsoar",
"url": "https://dev.azure.com/xsoar-organization/xsoar-project/_apis/git/repositories/XXXX/refs?filter=heads%2Fmain"
}
}
}
Human Readable Output
Branches List
Current page size: 1
Showing page 1 out others that may exist.
Name refs/heads/main
azure-devops-pull-request-reviewer-list
Retrieve the reviewers for a pull request.
Base Command
azure-devops-pull-request-reviewer-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| pull_request_id | ID of the pull request. By using the azure-devops-pull-request-list command, you can obtain the ID. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequestReviewer.reviewerUrl | String | URL to retrieve information about this identity. |
| AzureDevOps.PullRequestReviewer.vote | Number | Vote on a pull request, 10 - approved, 5 - approved with suggestions, 0 - no vote, -5 - waiting for author, -10 - rejected. |
| AzureDevOps.PullRequestReviewer.hasDeclined | Boolean | Whether the pull request has been declined. |
| AzureDevOps.PullRequestReviewer.isRequired | Boolean | Indicates if this is a required reviewer for this pull request. Branches can have policies that require particular reviewers are required for pull requests. |
| AzureDevOps.PullRequestReviewer.isFlagged | Boolean | A way to mark some special Pull Requests we are dealing with to distinguish them from other Pull Requests. |
| AzureDevOps.PullRequestReviewer.displayName | String | This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider. |
| AzureDevOps.PullRequestReviewer.url | String | REST URL for this resource. |
| AzureDevOps.PullRequestReviewer._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.PullRequestReviewer.id | String | Pull-request reviewers IDs. |
| AzureDevOps.PullRequestReviewer.uniqueName | String | The reviewers user name. |
| AzureDevOps.PullRequestReviewer.imageUrl | String | Link to the reviewers user image. |
azure-devops-pull-request-reviewer-add
Add a reviewer to a pull request.
Base Command
azure-devops-pull-request-reviewer-add
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| reviewer_user_id | ID of the reviewer. By using the azure-devops-user-list command, you can obtain the user ID. | Required |
| is_required | Indicates if this is a required reviewer for this pull request. Branches can have policies that require particular reviewers are required for pull requests. Possible values are: True, False. | Optional |
| pull_request_id | ID of the pull request. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequestReviewer.reviewerUrl | String | URL to retrieve information about this identity. |
| AzureDevOps.PullRequestReviewer.vote | Number | Vote on a pull request, 10 - approved, 5 - approved with suggestions, 0 - no vote, -5 - waiting for author, -10 - rejected. |
| AzureDevOps.PullRequestReviewer.hasDeclined | Boolean | Whether the pull request has been declined. |
| AzureDevOps.PullRequestReviewer.isFlagged | Boolean | A way to mark some special Pull Requests we are dealing with to distinguish them from other Pull Requests. |
| AzureDevOps.PullRequestReviewer._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.PullRequestReviewer.id | String | Pull-request reviewers IDs. |
| AzureDevOps.PullRequestReviewer.displayName | String | This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider. |
| AzureDevOps.PullRequestReviewer.uniqueName | String | The reviewers user name. |
| AzureDevOps.PullRequestReviewer.url | String | REST URL for this resource. |
| AzureDevOps.PullRequestReviewer.imageUrl | String | Link to the reviewers user image. |
azure-devops-pull-request-commit-list
Get the commits for the specified pull request.
Base Command
azure-devops-pull-request-commit-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| pull_request_id | ID of the pull request. By using the azure-devops-pull-request-list command, you can obtain the ID. | Required |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Commit.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.Commit.author.name | String | Name of the commit author. |
| AzureDevOps.Commit.author.email | String | Email address of the commit author. |
| AzureDevOps.Commit.author.date | Date | Date of the commit operation. |
| AzureDevOps.Commit.committer.name | String | Name of the commit committer. |
| AzureDevOps.Commit.committer.email | String | Email address of the commit committer. |
| AzureDevOps.Commit.committer.date | Date | Date of the commit operation. |
| AzureDevOps.Commit.comment | String | Comment or message of the commit. |
| AzureDevOps.Commit.url | String | REST URL for this resource. |
azure-devops-commit-list
Retrieve git commits for a project.
Base Command
azure-devops-commit-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Commit.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.Commit.author.name | String | Name of the commit author. |
| AzureDevOps.Commit.author.email | String | Email address of the commit author. |
| AzureDevOps.Commit.author.date | Date | Date of the commit operation. |
| AzureDevOps.Commit.committer.name | String | Name of the commit committer. |
| AzureDevOps.Commit.committer.email | String | Email address of the commit committer. |
| AzureDevOps.Commit.committer.date | Date | Date of the commit operation. |
| AzureDevOps.Commit.comment | String | Comment or message of the commit. |
| AzureDevOps.Commit.changeCounts | Number | Counts of the types of changes (edits, deletes, etc.) included with the commit. |
| AzureDevOps.Commit.url | String | REST URL for this resource. |
| AzureDevOps.Commit.remoteUrl | String | Remote URL path to the commit. |
azure-devops-commit-get
Retrieve a particular commit.
Base Command
azure-devops-commit-get
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| commit_id | The id of the commit. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Commit.treeId | String | Tree ID of the commit. |
| AzureDevOps.Commit.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.Commit.author.name | String | Name of the commit author. |
| AzureDevOps.Commit.author.email | String | Email address of the commit author. |
| AzureDevOps.Commit.author.date | Date | Date of the commit operation. |
| AzureDevOps.Commit.author.imageUrl | String | Link to the author user image. |
| AzureDevOps.Commit.committer.name | String | Name of the commit committer. |
| AzureDevOps.Commit.committer.email | String | Email address of the commit committer. |
| AzureDevOps.Commit.committer.date | Date | Date of the commit operation. |
| AzureDevOps.Commit.committer.imageUrl | String | Link to the committer user image. |
| AzureDevOps.Commit.comment | String | Comment or message of the commit. |
| AzureDevOps.Commit.parents | String | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.Commit.url | String | REST URL for this resource. |
| AzureDevOps.Commit.remoteUrl | String | Remote URL path to the commit. |
| AzureDevOps.Commit._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.Commit._links.repository.href | String | Link to the repository where the commit is. |
| AzureDevOps.Commit._links.web.href | String | Link to the commit. |
| AzureDevOps.Commit._links.changes.href | String | Link to the commit changes. |
| AzureDevOps.Commit.push.pushedBy.displayName | String | Display name of the user who pushed the commit. |
| AzureDevOps.Commit.push.pushedBy.url | String | Identity Reference. |
| AzureDevOps.Commit.push.pushedBy._links.avatar.href | String | Url for the user’s avatar. |
| AzureDevOps.Commit.push.pushedBy.id | String | ID of the user who pushed the commit. |
| AzureDevOps.Commit.push.pushedBy.uniqueName | String | Domain and principal name. |
| AzureDevOps.Commit.push.pushedBy.imageUrl | String | Identity Image. |
| AzureDevOps.Commit.push.pushedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.Commit.push.pushId | Number | Unique ID of the push operation. |
| AzureDevOps.Commit.push.date | Date | Date of the push operation. |
azure-devops-work-item-get
Returns a single work item.
Base Command
azure-devops-work-item-get
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| item_id | The work item id. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.WorkItem.id | Number | The work item ID. |
| AzureDevOps.WorkItem.rev | Number | Revision number of the work item. |
| AzureDevOps.WorkItem.fields.System.AreaPath | String | The work item AreaPath. Area paths allow you to group work items by team, product, or feature area. |
| AzureDevOps.WorkItem.fields.System.TeamProject | String | The work item TeamProject. A group of project members focused on specific products, services, or feature areas. |
| AzureDevOps.WorkItem.fields.System.IterationPath | String | The work item IterationPath. Iteration paths allow you to group work into sprints, milestones, or other event-specific or time-related period. |
| AzureDevOps.WorkItem.fields.System.WorkItemType | String | The work item type. Epic, Feature, User Story and Task/Bug. |
| AzureDevOps.WorkItem.fields.System.State | String | Workflow states define how a work item progresses from its creation to closure. The four main states that are defined for the User Story describe a user story’s progression. The workflow states are New, Active, Resolved, and Closed. |
| AzureDevOps.WorkItem.fields.System.Reason | String | This field requires a state to determine what values are allowed. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.displayName | String | Display name of user assigned to the work item. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.AssignedTo._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.id | String | ID of user assigned to the work item. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.uniqueName | String | The unique name of user assigned to the work item. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.imageUrl | String | Link to the user (assigned to the work item) image. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.CreatedDate | Date | The run creation date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.displayName | String | Display name of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.CreatedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.id | String | ID of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.uniqueName | String | The unique name of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.imageUrl | String | Link to the user (created the work item) image. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.ChangedDate | Date | The run changing date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.displayName | String | Display name of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.ChangedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.id | String | ID of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.uniqueName | String | The unique name of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.imageUrl | String | Link to the user (changed the work item) image. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.CommentCount | Number | Count of the work item comments. |
| AzureDevOps.WorkItem.fields.System.Title | String | The work item title. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.StateChangeDate | Date | The state changing date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedDate | Date | The activated date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.displayName | String | Display name of user activated the work item. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.id | String | ID of user activated the work item. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.uniqueName | String | The unique name of user activated the work item. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.imageUrl | String | Link to the user (activated the work item) image. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.Priority | Number | This field specifies which work the team should do first. |
| AzureDevOps.WorkItem.fields.System.Description | String | The work item description. |
| AzureDevOps.WorkItem.fields.System.Tags | String | Tags related to the work item. |
| AzureDevOps.WorkItem._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.WorkItem._links.workItemUpdates.href | String | Link to the work item updates. |
| AzureDevOps.WorkItem._links.workItemRevisions.href | String | Link to the work item revisions. |
| AzureDevOps.WorkItem._links.workItemComments.href | String | Link to the work item comments. |
| AzureDevOps.WorkItem._links.html.href | String | Link to the work item html. |
| AzureDevOps.WorkItem._links.workItemType.href | String | Link to the work item type. |
| AzureDevOps.WorkItem._links.fields.href | String | Link to the work item fields. |
| AzureDevOps.WorkItem.url | String | Link to the work item. |
azure-devops-work-item-create
Creates a single work item.
Base Command
azure-devops-work-item-create
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| type | The work item type of the work item to create. Possible values are: Task, Epic, Issue. | Required |
| title | The work item title of the work item to create. | Required |
| iteration_path | The path for the operation. | Optional |
| description | Describes the work item. | Optional |
| priority | Specifies which work the team should do first. Possible values are: 1, 2, 3, 4. | Optional |
| tag | Tag related to the work item. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.WorkItem.id | Number | The work item ID. |
| AzureDevOps.WorkItem.rev | Number | Revision number of the work item. |
| AzureDevOps.WorkItem.fields.System.AreaPath | String | The work item AreaPath. Area paths allow you to group work items by team, product, or feature area. |
| AzureDevOps.WorkItem.fields.System.TeamProject | String | The work item TeamProject. A group of project members focused on specific products, services, or feature areas. |
| AzureDevOps.WorkItem.fields.System.IterationPath | String | The work item IterationPath. Iteration paths allow you to group work into sprints, milestones, or other event-specific or time-related period. |
| AzureDevOps.WorkItem.fields.System.WorkItemType | String | The work item type. Epic, Feature, User Story and Task/Bug. |
| AzureDevOps.WorkItem.fields.System.State | String | Workflow states define how a work item progresses from its creation to closure. The four main states that are defined for the User Story describe a user story’s progression. The workflow states are New, Active, Resolved, and Closed. |
| AzureDevOps.WorkItem.fields.System.Reason | String | This field requires a state to determine what values are allowed. |
| AzureDevOps.WorkItem.fields.System.CreatedDate | Date | The run creation date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.displayName | String | Display name of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.CreatedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.id | String | ID of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.uniqueName | String | The unique name of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.imageUrl | String | Link to the user (created the work item) image. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.ChangedDate | Date | The run changing date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.displayName | String | Display name of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.ChangedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.id | String | ID of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.uniqueName | String | The unique name of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.imageUrl | String | Link to the user (changed the work item) image. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.CommentCount | Number | Count of the work item comments. |
| AzureDevOps.WorkItem.fields.System.Title | String | The work item title. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.StateChangeDate | Date | The state changing date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.Priority | Number | This field specifies which work the team should do first. |
| AzureDevOps.WorkItem.fields.System.Description | String | The work item description. |
| AzureDevOps.WorkItem.fields.System.Tags | String | Tags related to the work item. |
| AzureDevOps.WorkItem._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.WorkItem._links.workItemUpdates.href | String | Link to the work item updates. |
| AzureDevOps.WorkItem._links.workItemRevisions.href | String | Link to the work item revisions. |
| AzureDevOps.WorkItem._links.workItemComments.href | String | Link to the work item comments. |
| AzureDevOps.WorkItem._links.html.href | String | Link to the work item html. |
| AzureDevOps.WorkItem._links.workItemType.href | String | Link to the work item type. |
| AzureDevOps.WorkItem._links.fields.href | String | Link to the work item fields. |
| AzureDevOps.WorkItem.url | String | Link to the work item. |
azure-devops-work-item-update
Updates a single work item.
Base Command
azure-devops-work-item-update
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| item_id | The work item id to update. | Required |
| title | A new title for the work item. | Optional |
| assignee_display_name | Display name of user assigned to the work item. This argument can be obtained by running the ‘azure-devops-user-list’ command. | Optional |
| state | A new state for the work item. Possible values are: To Do, Doing, Done. | Optional |
| iteration_path | a new path for the operation. | Optional |
| description | A new description for the work item. | Optional |
| priority | A new priority for the work item. Possible values are: 1, 2, 3, 4. | Optional |
| tag | A new priority for the work item. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.WorkItem.id | Number | The work item ID. |
| AzureDevOps.WorkItem.rev | Number | Revision number of the work item. |
| AzureDevOps.WorkItem.fields.System.AreaPath | String | The work item AreaPath. Area paths allow you to group work items by team, product, or feature area. |
| AzureDevOps.WorkItem.fields.System.TeamProject | String | The work item TeamProject. A group of project members focused on specific products, services, or feature areas. |
| AzureDevOps.WorkItem.fields.System.IterationPath | String | The work item IterationPath. Iteration paths allow you to group work into sprints, milestones, or other event-specific or time-related period. |
| AzureDevOps.WorkItem.fields.System.WorkItemType | String | The work item type. Epic, Feature, User Story and Task/Bug. |
| AzureDevOps.WorkItem.fields.System.State | String | Workflow states define how a work item progresses from its creation to closure. The four main states that are defined for the User Story describe a user story’s progression. The workflow states are New, Active, Resolved, and Closed. |
| AzureDevOps.WorkItem.fields.System.Reason | String | This field requires a state to determine what values are allowed. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.displayName | String | Display name of user assigned to the work item. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.AssignedTo._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.id | String | ID of user assigned to the work item. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.uniqueName | String | The unique name of user assigned to the work item. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.imageUrl | String | Link to the user (assigned to the work item) image. |
| AzureDevOps.WorkItem.fields.System.AssignedTo.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.CreatedDate | Date | The run creation date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.displayName | String | Display name of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.CreatedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.id | String | ID of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.uniqueName | String | The unique name of user created the work item. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.imageUrl | String | Link to the user (created the work item) image. |
| AzureDevOps.WorkItem.fields.System.CreatedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.ChangedDate | Date | The run changing date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.displayName | String | Display name of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.System.ChangedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.id | String | ID of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.uniqueName | String | The unique name of user changed the work item. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.imageUrl | String | Link to the user (changed the work item) image. |
| AzureDevOps.WorkItem.fields.System.ChangedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.System.CommentCount | Number | Count of the work item comments. |
| AzureDevOps.WorkItem.fields.System.Title | String | The work item title. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.StateChangeDate | Date | The state changing date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedDate | Date | The activated date, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.displayName | String | Display name of user activated the work item. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.url | String | The work item url. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.id | String | ID of user activated the work item. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.uniqueName | String | The unique name of user activated the work item. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.imageUrl | String | Link to the user (activated the work item) image. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.ActivatedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.WorkItem.fields.Microsoft.VSTS.Common.Priority | Number | This field specifies which work the team should do first. |
| AzureDevOps.WorkItem.fields.System.Description | String | The work item description. |
| AzureDevOps.WorkItem.fields.System.Tags | String | Tags related to the work item. |
| AzureDevOps.WorkItem._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.WorkItem._links.workItemUpdates.href | String | Link to the work item updates. |
| AzureDevOps.WorkItem._links.workItemRevisions.href | String | Link to the work item revisions. |
| AzureDevOps.WorkItem._links.workItemComments.href | String | Link to the work item comments. |
| AzureDevOps.WorkItem._links.html.href | String | Link to the work item html. |
| AzureDevOps.WorkItem._links.workItemType.href | String | Link to the work item type. |
| AzureDevOps.WorkItem._links.fields.href | String | Link to the work item fields. |
| AzureDevOps.WorkItem.url | String | Link to the work item. |
azure-devops-file-create
Add a file to the repository.
Base Command
azure-devops-file-create
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| branch_name | The branch name. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| branch_id | The branch ID. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| commit_comment | Comment or message of the commit. | Required |
| file_path | The file path. | Optional |
| file_content | The file content. | Optional |
| entry_id | There is an option to the user to provide an entry_id. In that case we will take the file_content and the file_path from the given id. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.File.commits.treeId | String | Tree ID of the commit. |
| AzureDevOps.File.commits.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.File.commits.author.name | String | Name of the commit author. |
| AzureDevOps.File.commits.author.email | String | Email address of the commit author. |
| AzureDevOps.File.commits.author.date | Date | Date of the commit operation. |
| AzureDevOps.File.commits.committer.name | String | Name of the commit committer. |
| AzureDevOps.File.commits.committer.email | String | Email address of the commit committer. |
| AzureDevOps.File.commits.committer.date | Date | Date of the commit operation. |
| AzureDevOps.File.commits.comment | String | Comment or message of the commit. |
| AzureDevOps.File.commits.parents | String | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.File.commits.url | String | REST URL for this resource. |
| AzureDevOps.File.refUpdates.repositoryId | String | The ID of the repository. |
| AzureDevOps.File.refUpdates.name | String | The branch name. |
| AzureDevOps.File.refUpdates.oldObjectId | String | The last commit ID. |
| AzureDevOps.File.refUpdates.newObjectId | String | The new commit ID. |
| AzureDevOps.File.repository.id | String | The ID of the repository. |
| AzureDevOps.File.repository.name | String | The name of the repository. |
| AzureDevOps.File.repository.url | String | The URL of the repository. |
| AzureDevOps.File.repository.project.id | String | The ID of the Project. |
| AzureDevOps.File.repository.project.name | String | The name of the project. |
| AzureDevOps.File.repository.project.description | String | The description of the project. |
| AzureDevOps.File.repository.project.url | String | The URL of the project. |
| AzureDevOps.File.repository.project.state | String | The state of the project. |
| AzureDevOps.File.repository.project.revision | Number | The revision number of the project. |
| AzureDevOps.File.repository.project.visibility | String | Indicates whom the project is visible to. |
| AzureDevOps.File.repository.project.lastUpdateTime | Date | The project last update time, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.File.repository.size | Number | The size of the repository (in bytes). |
| AzureDevOps.File.repository.remoteUrl | String | Remote URL path to the repository. |
| AzureDevOps.File.repository.sshUrl | String | The ssh URL of the repository. |
| AzureDevOps.File.repository.webUrl | String | The web URL of the repository. |
| AzureDevOps.File.repository.isDisabled | Boolean | If the repository is disabled or not. |
| AzureDevOps.File.repository.isInMaintenance | Boolean | If the repository is in maintenance or not. |
| AzureDevOps.File.pushedBy.displayName | String | Display name of the user who pushed the commit / file. |
| AzureDevOps.File.pushedBy.url | String | Identity Reference. |
| AzureDevOps.File.pushedBy._links.avatar.href | String | Url for the user’s avatar. |
| AzureDevOps.File.pushedBy.id | String | ID of the user who pushed the commit / file. |
| AzureDevOps.File.pushedBy.uniqueName | String | Domain and principal name. |
| AzureDevOps.File.pushedBy.imageUrl | String | Identity Image. |
| AzureDevOps.File.pushedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.File.pushId | Number | Unique ID of the push operation. |
| AzureDevOps.File.date | Date | Date of the operation. |
| AzureDevOps.File.url | String | Link to the commit. |
| AzureDevOps.File._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.File._links.repository.href | String | Link to the repository where the commit is. |
| AzureDevOps.File._links.commits.href | String | Link to the commits. |
| AzureDevOps.File._links.pusher.href | String | Link to the commit pusher. |
| AzureDevOps.File._links.refs.href | String | Link to the branch. |
azure-devops-file-update
Update a file in the repository.
Base Command
azure-devops-file-update
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| branch_name | The branch name. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| branch_id | The branch ID. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| commit_comment | Comment or message of the commit. | Required |
| file_path | The file path. | Optional |
| file_content | The file content. | Optional |
| entry_id | There is an option to the user to provide an entry_id. In that case we will take the file_content and the file_path from the given id. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.File.commits.treeId | String | Tree ID of the commit. |
| AzureDevOps.File.commits.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.File.commits.author.name | String | Name of the commit author. |
| AzureDevOps.File.commits.author.email | String | Email address of the commit author. |
| AzureDevOps.File.commits.author.date | Date | Date of the commit operation. |
| AzureDevOps.File.commits.committer.name | String | Name of the commit committer. |
| AzureDevOps.File.commits.committer.email | String | Email address of the commit committer. |
| AzureDevOps.File.commits.committer.date | Date | Date of the commit operation. |
| AzureDevOps.File.commits.comment | String | Comment or message of the commit. |
| AzureDevOps.File.commits.parents | String | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.File.commits.url | String | REST URL for this resource. |
| AzureDevOps.File.refUpdates.repositoryId | String | The ID of the repository. |
| AzureDevOps.File.refUpdates.name | String | The branch name. |
| AzureDevOps.File.refUpdates.oldObjectId | String | The last commit ID. |
| AzureDevOps.File.refUpdates.newObjectId | String | The new commit ID. |
| AzureDevOps.File.repository.id | String | The ID of the repository. |
| AzureDevOps.File.repository.name | String | The name of the repository. |
| AzureDevOps.File.repository.url | String | The URL of the repository. |
| AzureDevOps.File.repository.project.id | String | The ID of the Project. |
| AzureDevOps.File.repository.project.name | String | The name of the project. |
| AzureDevOps.File.repository.project.description | String | The description of the project. |
| AzureDevOps.File.repository.project.url | String | The URL of the project. |
| AzureDevOps.File.repository.project.state | String | The state of the project. |
| AzureDevOps.File.repository.project.revision | Number | The revision number of the project. |
| AzureDevOps.File.repository.project.visibility | String | Indicates whom the project is visible to. |
| AzureDevOps.File.repository.project.lastUpdateTime | Date | The project last update time, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.File.repository.size | Number | The size of the repository (in bytes). |
| AzureDevOps.File.repository.remoteUrl | String | Remote URL path to the repository. |
| AzureDevOps.File.repository.sshUrl | String | The ssh URL of the repository. |
| AzureDevOps.File.repository.webUrl | String | The web URL of the repository. |
| AzureDevOps.File.repository.isDisabled | Boolean | If the repository is disabled or not. |
| AzureDevOps.File.repository.isInMaintenance | Boolean | If the repository is in maintenance or not. |
| AzureDevOps.File.pushedBy.displayName | String | Display name of the user who pushed the commit / file. |
| AzureDevOps.File.pushedBy.url | String | Identity Reference. |
| AzureDevOps.File.pushedBy._links.avatar.href | String | Url for the user’s avatar. |
| AzureDevOps.File.pushedBy.id | String | ID of the user who pushed the commit / file. |
| AzureDevOps.File.pushedBy.uniqueName | String | Domain and principal name. |
| AzureDevOps.File.pushedBy.imageUrl | String | Identity Image. |
| AzureDevOps.File.pushedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.File.pushId | Number | Unique ID of the push operation. |
| AzureDevOps.File.date | Date | Date of the operation. |
| AzureDevOps.File.url | String | Link to the commit. |
| AzureDevOps.File._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.File._links.repository.href | String | Link to the repository where the commit is. |
| AzureDevOps.File._links.commits.href | String | Link to the commits. |
| AzureDevOps.File._links.pusher.href | String | Link to the commit pusher. |
| AzureDevOps.File._links.refs.href | String | Link to the branch. |
azure-devops-file-delete
Update a file in the repository.
Base Command
azure-devops-file-delete
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| branch_name | The branch name. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| branch_id | The branch ID. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| commit_comment | Comment or message of the commit. | Required |
| file_path | The file path. | Optional |
| entry_id | There is an option to the user to provide an entry_id. In that case we will take the file_content and the file_path from the given id. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.File.commits.treeId | String | Tree ID of the commit. |
| AzureDevOps.File.commits.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.File.commits.author.name | String | Name of the commit author. |
| AzureDevOps.File.commits.author.email | String | Email address of the commit author. |
| AzureDevOps.File.commits.author.date | Date | Date of the commit operation. |
| AzureDevOps.File.commits.committer.name | String | Name of the commit committer. |
| AzureDevOps.File.commits.committer.email | String | Email address of the commit committer. |
| AzureDevOps.File.commits.committer.date | Date | Date of the commit operation. |
| AzureDevOps.File.commits.comment | String | Comment or message of the commit. |
| AzureDevOps.File.commits.parents | String | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.File.commits.url | String | REST URL for this resource. |
| AzureDevOps.File.refUpdates.repositoryId | String | The ID of the repository. |
| AzureDevOps.File.refUpdates.name | String | The branch name. |
| AzureDevOps.File.refUpdates.oldObjectId | String | The last commit ID. |
| AzureDevOps.File.refUpdates.newObjectId | String | The new commit ID. |
| AzureDevOps.File.repository.id | String | The ID of the repository. |
| AzureDevOps.File.repository.name | String | The name of the repository. |
| AzureDevOps.File.repository.url | String | The URL of the repository. |
| AzureDevOps.File.repository.project.id | String | The ID of the Project. |
| AzureDevOps.File.repository.project.name | String | The name of the project. |
| AzureDevOps.File.repository.project.description | String | The description of the project. |
| AzureDevOps.File.repository.project.url | String | The URL of the project. |
| AzureDevOps.File.repository.project.state | String | The state of the project. |
| AzureDevOps.File.repository.project.revision | Number | The revision number of the project. |
| AzureDevOps.File.repository.project.visibility | String | Indicates whom the project is visible to. |
| AzureDevOps.File.repository.project.lastUpdateTime | Date | The project last update time, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.File.repository.size | Number | The size of the repository (in bytes). |
| AzureDevOps.File.repository.remoteUrl | String | Remote URL path to the repository. |
| AzureDevOps.File.repository.sshUrl | String | The ssh URL of the repository. |
| AzureDevOps.File.repository.webUrl | String | The web URL of the repository. |
| AzureDevOps.File.repository.isDisabled | Boolean | If the repository is disabled or not. |
| AzureDevOps.File.repository.isInMaintenance | Boolean | If the repository is in maintenance or not. |
| AzureDevOps.File.pushedBy.displayName | String | Display name of the user who pushed the commit / file. |
| AzureDevOps.File.pushedBy.url | String | Identity Reference. |
| AzureDevOps.File.pushedBy._links.avatar.href | String | Url for the user’s avatar. |
| AzureDevOps.File.pushedBy.id | String | ID of the user who pushed the commit / file. |
| AzureDevOps.File.pushedBy.uniqueName | String | Domain and principal name. |
| AzureDevOps.File.pushedBy.imageUrl | String | Identity Image. |
| AzureDevOps.File.pushedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.File.pushId | Number | Unique ID of the push operation. |
| AzureDevOps.File.date | Date | Date of the operation. |
| AzureDevOps.File.url | String | Link to the commit. |
| AzureDevOps.File._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.File._links.repository.href | String | Link to the repository where the commit is. |
| AzureDevOps.File._links.commits.href | String | Link to the commits. |
| AzureDevOps.File._links.pusher.href | String | Link to the commit pusher. |
| AzureDevOps.File._links.refs.href | String | Link to the branch. |
azure-devops-file-list
Retrieve repository files (items) list.
Base Command
azure-devops-file-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| branch_name | The branch name. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| recursion_level | The recursion level of this request. The default is None, no recursion. Possible values are: None, OneLevel, Full. Default is None. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.File.objectId | String | The file object ID. |
| AzureDevOps.File.gitObjectType | String | The file git object type. |
| AzureDevOps.File.commitId | String | ID (SHA-1) of the file commit. |
| AzureDevOps.File.path | String | The file’s path. |
| AzureDevOps.File.isFolder | Boolean | If the item is folder or not. |
| AzureDevOps.File.contentMetadata.fileName | String | The file name. |
| AzureDevOps.File.url | String | URL link to the item. |
azure-devops-file-get
Getting the content file.
Base Command
azure-devops-file-get
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| branch_name | The branch name. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| file_name | The file name. | Required |
| format | The file format (json or zip). Default is json. Possible values are: json, zip. Default is json. | Optional |
| include_content | Include item content. Default is True. Possible values are: True, False. Default is True. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.File.objectId | String | The file object ID. |
| AzureDevOps.File.gitObjectType | String | The file git object type. |
| AzureDevOps.File.commitId | String | ID (SHA-1) of the file commit. |
| AzureDevOps.File.path | String | The file’s path. |
| AzureDevOps.File.content | String | The file content. |
azure-devops-branch-create
Create a branch.
Base Command
azure-devops-branch-create
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| branch_name | The branch name. This argument can be obtained by running the ‘azure-devops-branch-list’ command. | Required |
| commit_comment | Comment or message of the commit. | Required |
| file_path | The file path. | Optional |
| file_content | The file content. | Optional |
| entry_id | There is an option to the user to provide an entry_id. In that case we will take the file_content and the file_path from the given id. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Branch.commits.treeId | String | Tree ID of the commit. |
| AzureDevOps.Branch.commits.commitId | String | ID (SHA-1) of the commit. |
| AzureDevOps.Branch.commits.author.name | String | Name of the commit author. |
| AzureDevOps.Branch.commits.author.email | String | Email address of the commit author. |
| AzureDevOps.Branch.commits.author.date | Date | Date of the commit operation. |
| AzureDevOps.Branch.commits.committer.name | String | Name of the commit committer. |
| AzureDevOps.Branch.commits.committer.email | String | Email address of the commit committer. |
| AzureDevOps.Branch.commits.committer.date | Date | Date of the commit operation. |
| AzureDevOps.Branch.commits.comment | String | Comment or message of the commit. |
| AzureDevOps.Branch.commits.parents | Unknown | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.Branch.commits.url | String | REST URL for this resource. |
| AzureDevOps.Branch.refUpdates.repositoryId | String | The ID of the repository. |
| AzureDevOps.Branch.refUpdates.name | String | The branch name. |
| AzureDevOps.Branch.refUpdates.oldObjectId | String | The last commit ID. |
| AzureDevOps.Branch.refUpdates.newObjectId | String | The new commit ID. |
| AzureDevOps.Branch.repository.id | String | The ID of the repository. |
| AzureDevOps.Branch.repository.name | String | The name of the repository. |
| AzureDevOps.Branch.repository.url | String | The URL of the repository. |
| AzureDevOps.Branch.repository.project.id | String | The ID of the Project. |
| AzureDevOps.Branch.repository.project.name | String | The name of the project. |
| AzureDevOps.Branch.repository.project.description | String | The description of the project. |
| AzureDevOps.Branch.repository.project.url | String | The URL of the project. |
| AzureDevOps.Branch.repository.project.state | String | The state of the project. |
| AzureDevOps.Branch.repository.project.revision | Number | The revision number of the project. |
| AzureDevOps.Branch.repository.project.visibility | String | Indicates whom the project is visible to. |
| AzureDevOps.Branch.repository.project.lastUpdateTime | Date | The project last update time, using ISO 8601 format in UTC time. For example, midnight UTC on Jan 1, 2022 would be: “2022-01-01T00:00:00Z”. |
| AzureDevOps.Branch.repository.size | Number | The size of the repository (in bytes). |
| AzureDevOps.Branch.repository.remoteUrl | String | Remote URL path to the repository. |
| AzureDevOps.Branch.repository.sshUrl | String | The ssh URL of the repository. |
| AzureDevOps.Branch.repository.webUrl | String | The web URL of the repository. |
| AzureDevOps.Branch.repository.isDisabled | Boolean | If the repository is disabled or not. |
| AzureDevOps.Branch.repository.isInMaintenance | Boolean | If the repository is in maintenance or not. |
| AzureDevOps.Branch.pushedBy.displayName | String | Display name of the user who pushed the commit / file. |
| AzureDevOps.Branch.pushedBy.url | String | Identity Reference. |
| AzureDevOps.Branch.pushedBy._links.avatar.href | String | Url for the user’s avatar. |
| AzureDevOps.Branch.pushedBy.id | String | ID of the user who pushed the commit / file. |
| AzureDevOps.Branch.pushedBy.uniqueName | String | Domain and principal name. |
| AzureDevOps.Branch.pushedBy.imageUrl | String | Identity Image. |
| AzureDevOps.Branch.pushedBy.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.Branch.pushId | Number | Unique ID of the push operation. |
| AzureDevOps.Branch.date | Date | Date of the operation. |
| AzureDevOps.Branch.url | String | Link to the commit. |
| AzureDevOps.Branch._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.Branch._links.repository.href | String | Link to the repository where the commit is. |
| AzureDevOps.Branch._links.commits.href | String | Link to the commits. |
| AzureDevOps.Branch._links.pusher.href | String | Link to the commit pusher. |
| AzureDevOps.Branch._links.refs.href | String | Link to the branch. |
azure-devops-pull-request-thread-create
Create a thread in a pull request.
Base Command
azure-devops-pull-request-thread-create
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| pull_request_id | The ID of the pull request to update. | Required |
| comment_text | The comment content. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequestThread.pullRequestThreadContext | Unknown | Extended context information unique to pull requests. |
| AzureDevOps.PullRequestThread.id | Number | The ID of the pull request. |
| AzureDevOps.PullRequestThread.publishedDate | Date | The date the thread was published. |
| AzureDevOps.PullRequestThread.lastUpdatedDate | Date | Last update date. |
| AzureDevOps.PullRequestThread.comments.id | Number | The ID of the comments. |
| AzureDevOps.PullRequestThread.comments.parentCommentId | Number | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.PullRequestThread.comments.author.displayName | String | The display name of the comments creator. |
| AzureDevOps.PullRequestThread.comments.author.url | String | URL to retrieve information about this identity. |
| AzureDevOps.PullRequestThread.comments.author._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.PullRequestThread.comments.author.id | String | The ID of the thread author. |
| AzureDevOps.PullRequestThread.comments.author.uniqueName | String | The unique name of the thread author. |
| AzureDevOps.PullRequestThread.comments.author.imageUrl | String | Link to the thread author user image. |
| AzureDevOps.PullRequestThread.comments.author.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.PullRequestThread.comments.content | String | The comments content. |
| AzureDevOps.PullRequestThread.comments.publishedDate | Date | The date the comments were published. |
| AzureDevOps.PullRequestThread.comments.lastUpdatedDate | Date | Last update date. |
| AzureDevOps.PullRequestThread.comments.lastContentUpdatedDate | Date | The date the comment’s content was last updated. |
| AzureDevOps.PullRequestThread.comments.commentType | String | The comment type at the time of creation. |
| AzureDevOps.PullRequestThread.comments._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.PullRequestThread.comments._links.repository.href | String | Link to the repository where the comments are. |
| AzureDevOps.PullRequestThread.comments._links.threads.href | String | Link to the threads. |
| AzureDevOps.PullRequestThread.comments._links.pullRequests.href | String | Link to the pull request. |
| AzureDevOps.PullRequestThread.status | String | The status of the pull request thread. |
| AzureDevOps.PullRequestThread.threadContext | Unknown | Extended context information unique to pull requests. |
| AzureDevOps.PullRequestThread.properties | Unknown | Properties associated with the thread as a collection of key-value pairs. |
| AzureDevOps.PullRequestThread.identities | Unknown | Set of identities related to this thread. |
| AzureDevOps.PullRequestThread.isDeleted | Boolean | Specify if the thread is deleted which happens when all comments are deleted. |
| AzureDevOps.PullRequestThread._links.self.href | String | Link to the thread. |
| AzureDevOps.PullRequestThread._links.repository.href | String | Link to the repository. |
azure-devops-pull-request-thread-update
Update a thread in a pull request.
Base Command
azure-devops-pull-request-thread-update
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| pull_request_id | The ID of the pull request to update. | Required |
| thread_id | The ID of the thread to update. | Required |
| comment_text | The comment content. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequestThread.pullRequestThreadContext | Unknown | Extended context information unique to pull requests. |
| AzureDevOps.PullRequestThread.id | Number | The ID of the pull request. |
| AzureDevOps.PullRequestThread.publishedDate | Date | The date the thread was published. |
| AzureDevOps.PullRequestThread.lastUpdatedDate | Date | Last update date. |
| AzureDevOps.PullRequestThread.comments.id | Number | The ID of the comments. |
| AzureDevOps.PullRequestThread.comments.parentCommentId | Number | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.PullRequestThread.comments.author.displayName | String | The display name of the comments creator. |
| AzureDevOps.PullRequestThread.comments.author.url | String | URL to retrieve information about this identity. |
| AzureDevOps.PullRequestThread.comments.author._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.PullRequestThread.comments.author.id | String | The ID of the thread author. |
| AzureDevOps.PullRequestThread.comments.author.uniqueName | String | The unique name of the thread author. |
| AzureDevOps.PullRequestThread.comments.author.imageUrl | String | Link to the thread author user image. |
| AzureDevOps.PullRequestThread.comments.author.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.PullRequestThread.comments.content | String | The comments content. |
| AzureDevOps.PullRequestThread.comments.publishedDate | Date | The date the comments were published. |
| AzureDevOps.PullRequestThread.comments.lastUpdatedDate | Date | Last update date. |
| AzureDevOps.PullRequestThread.comments.lastContentUpdatedDate | Date | The date the comment’s content was last updated. |
| AzureDevOps.PullRequestThread.comments.commentType | String | The comment type at the time of creation. |
| AzureDevOps.PullRequestThread.comments._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.PullRequestThread.comments._links.repository.href | String | Link to the repository where the comments are. |
| AzureDevOps.PullRequestThread.comments._links.threads.href | String | Link to the threads. |
| AzureDevOps.PullRequestThread.comments._links.pullRequests.href | String | Link to the pull request. |
| AzureDevOps.PullRequestThread.status | String | The status of the pull request thread. |
| AzureDevOps.PullRequestThread.threadContext | Unknown | Extended context information unique to pull requests. |
| AzureDevOps.PullRequestThread.properties | Unknown | Properties associated with the thread as a collection of key-value pairs. |
| AzureDevOps.PullRequestThread.identities | Unknown | Set of identities related to this thread. |
| AzureDevOps.PullRequestThread.isDeleted | Boolean | Specify if the thread is deleted which happens when all comments are deleted. |
| AzureDevOps.PullRequestThread._links.self.href | String | Link to the thread. |
| AzureDevOps.PullRequestThread._links.repository.href | String | Link to the repository. |
azure-devops-pull-request-thread-list
Retrieve all threads in a pull request.
Base Command
azure-devops-pull-request-thread-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| pull_request_id | The ID of the pull request to update. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.PullRequestThread.pullRequestThreadContext | Unknown | Extended context information unique to pull requests. |
| AzureDevOps.PullRequestThread.id | Number | The ID of the pull request. |
| AzureDevOps.PullRequestThread.publishedDate | Date | The date the thread was published. |
| AzureDevOps.PullRequestThread.lastUpdatedDate | Date | Last update date. |
| AzureDevOps.PullRequestThread.comments.id | Number | The ID of the comments. |
| AzureDevOps.PullRequestThread.comments.parentCommentId | Number | An enumeration of the parent commit IDs for this commit. |
| AzureDevOps.PullRequestThread.comments.author.displayName | String | The display name of the comments creator. |
| AzureDevOps.PullRequestThread.comments.author.url | String | URL to retrieve information about this identity. |
| AzureDevOps.PullRequestThread.comments.author._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.PullRequestThread.comments.author.id | String | The ID of the thread author. |
| AzureDevOps.PullRequestThread.comments.author.uniqueName | String | The unique name of the thread author. |
| AzureDevOps.PullRequestThread.comments.author.imageUrl | String | Link to the thread author user image. |
| AzureDevOps.PullRequestThread.comments.author.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.PullRequestThread.comments.content | String | The comments content. |
| AzureDevOps.PullRequestThread.comments.publishedDate | Date | The date the comments were published. |
| AzureDevOps.PullRequestThread.comments.lastUpdatedDate | Date | Last update date. |
| AzureDevOps.PullRequestThread.comments.lastContentUpdatedDate | Date | The date the comment’s content was last updated. |
| AzureDevOps.PullRequestThread.comments.commentType | String | The comment type at the time of creation. |
| AzureDevOps.PullRequestThread.comments.usersLiked | Unknown | A list of the users who have liked this comment. |
| AzureDevOps.PullRequestThread.comments._links.self.href | String | A collection of related REST reference links. |
| AzureDevOps.PullRequestThread.comments._links.repository.href | String | Link to the repository where the comments are. |
| AzureDevOps.PullRequestThread.comments._links.threads.href | String | Link to the threads. |
| AzureDevOps.PullRequestThread.comments._links.pullRequests.href | String | Link to the pull request. |
| AzureDevOps.PullRequestThread.threadContext | Unknown | Extended context information unique to pull requests. |
| AzureDevOps.PullRequestThread.properties.CodeReviewThreadType.$type | String | The type of the code review thread. |
| AzureDevOps.PullRequestThread.properties.CodeReviewThreadType.$value | String | The content in the code review thread. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumAdded.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumAdded.$value | Number | Number of code reviewers updated the pull request. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumChanged.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumChanged.$value | Number | Number of code reviewers changed the pull request. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumDeclined.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumDeclined.$value | Number | Number of code reviewers declined the pull request. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumRemoved.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedNumRemoved.$value | Number | Number of code reviewers are removed. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedAddedIdentity.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedAddedIdentity.$value | String | Number of code reviewers added identity. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedByIdentity.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedByIdentity.$value | String | Number of code reviewers updated by identity. |
| AzureDevOps.PullRequestThread.identities.1.displayName | String | The display name of the pull request thread creator. |
| AzureDevOps.PullRequestThread.identities.1.url | String | Link to the the pull request thread creator. |
| AzureDevOps.PullRequestThread.identities.1._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.PullRequestThread.identities.1.id | String | The ID of the pull request thread creator. |
| AzureDevOps.PullRequestThread.identities.1.uniqueName | String | The user name of the pull request thread creator. |
| AzureDevOps.PullRequestThread.identities.1.imageUrl | String | Link to the pull request thread creator user image. |
| AzureDevOps.PullRequestThread.identities.1.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
| AzureDevOps.PullRequestThread.isDeleted | Boolean | Specify if the thread is deleted which happens when all comments are deleted. |
| AzureDevOps.PullRequestThread._links.self.href | String | Link to the thread. |
| AzureDevOps.PullRequestThread._links.repository.href | String | Link to the repository. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedChangedToRequired.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedChangedToRequired.$value | String | Number of code reviewers were changed to required. |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedChangedIdentity.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.CodeReviewReviewersUpdatedChangedIdentity.$value | String | Number of code reviewers changed the identity. |
| AzureDevOps.PullRequestThread.status | String | The status of the comment thread. |
| AzureDevOps.PullRequestThread.properties | Unknown | Properties associated with the thread as a collection of key-value pairs. |
| AzureDevOps.PullRequestThread.identities | Unknown | Set of identities related to this thread. |
| AzureDevOps.PullRequestThread.properties.Microsoft.TeamFoundation.Discussion.SupportsMarkdown.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.Microsoft.TeamFoundation.Discussion.SupportsMarkdown.$value | Number | Supports markdown number. |
| AzureDevOps.PullRequestThread.properties.Microsoft.TeamFoundation.Discussion.UniqueID.$type | String | A number (Int32). |
| AzureDevOps.PullRequestThread.properties.Microsoft.TeamFoundation.Discussion.UniqueID.$value | String | The unique ID of the Team Foundation. |
azure-devops-project-team-list
Get a list of teams.
Base Command
azure-devops-project-team-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.Team.id | String | Team (Identity) Guid. A Team Foundation ID. |
| AzureDevOps.Team.name | String | Team name. |
| AzureDevOps.Team.url | String | Team REST API Url. |
| AzureDevOps.Team.description | String | Team description. |
| AzureDevOps.Team.identityUrl | String | Identity REST API Url to this team. |
| AzureDevOps.Team.projectName | String | The project name. |
| AzureDevOps.Team.projectId | String | The project ID. |
azure-devops-team-member-list
Get a list of members for a specific team.
Base Command
azure-devops-team-member-list
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| team_id | The name or ID (GUID) of the team . | Required |
| page | The page number of the results to retrieve. Minimum value is 1. Default is 1. | Optional |
| limit | The number of results to retrieve. Minimum value is 1. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| AzureDevOps.TeamMember.isTeamAdmin | Boolean | if the member is the team admin. |
| AzureDevOps.TeamMember.identity.displayName | String | The display name of the team member. |
| AzureDevOps.TeamMember.identity.url | String | URL to retrieve information about this member. |
| AzureDevOps.TeamMember.identity._links.avatar.href | String | This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject. |
| AzureDevOps.TeamMember.identity.id | String | ID of the team member. |
| AzureDevOps.TeamMember.identity.uniqueName | String | The unique name of team member. |
| AzureDevOps.TeamMember.identity.imageUrl | String | Link to the team member image. |
| AzureDevOps.TeamMember.identity.descriptor | String | The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations. |
azure-devops-blob-zip-get
Get a single blob.
Base Command
azure-devops-blob-zip-get
Input
| Argument Name | Description | Required |
|---|---|---|
| organization_name | The name of the Azure DevOps organization. Default value will be config param, user can supply a different value. | Optional |
| project_name | Project ID or project name. Default value will be config param, user can supply a different value. | Optional |
| repository_id | The repository ID. Default value will be config param, user can supply a different value. | Optional |
| file_object_id | The ID of the blob object. This ID can be obtained by running the ‘azure-devops-file-list’ command. | Required |
Context Output
There is no context output for this command.
Incident Mirroring
You can enable incident mirroring between Cortex XSOAR incidents and AzureDevOps corresponding events (available from Cortex XSOAR version 6.0.0).
To set up the mirroring:
- Enable Fetching incidents in your instance configuration.
Newly fetched incidents will be mirrored in the chosen direction. However, this selection does not affect existing incidents.
Important Note: To ensure the mirroring works as expected, mappers are required, both for incoming and outgoing, to map the expected fields in Cortex XSOAR and AzureDevOps.
Configuration parameters
client_id— Client ID (required)organization— Organization (required)max_fetch— Maximum incidents for one fetch.project— Default Project Namerepository— Default Repository NameincidentType— Incident typeincidentFetchInterval— Incidents Fetch IntervalisFetch— Fetch incidentsfirst_fetch— First fetch timestamp (<number> <time unit>, e.g., 12 hours, 7 days)is_mirroring— Outgoing mirroringproxy— Use system proxy settingsinsecure— Trust any certificate (not secure)auth_type— Authentication Type (required)tenant_id— Tenant IDcredentials— Client Secretredirect_uri— Application redirect URIauth_code— Authorization code
Commands (40)
-
azure-devops-auth-completeRun this command to complete the authorization process. Should be used after running the azure-devops-auth-start command.
-
azure-devops-auth-resetRun this command if for some reason you need to rerun the authentication process.
-
azure-devops-auth-startRun this command to start the authorization process and follow the instructions in the command results.
-
azure-devops-auth-testTests the connectivity to Azure.
-
azure-devops-blob-zip-getGet a single blob.
-
azure-devops-branch-createCreate a branch.
-
azure-devops-branch-listRetrieve repository branches list.
-
azure-devops-commit-getRetrieve a particular commit.
-
azure-devops-commit-listRetrieve Git commits for a project.
-
azure-devops-file-createAdd a file to the repository.
-
azure-devops-file-deleteUpdate a file in the repository.
-
azure-devops-file-getGetting the content file.
-
azure-devops-file-listRetrieve repository files (items) list.
-
azure-devops-file-updateUpdate a file in the repository.
-
azure-devops-generate-login-urlGenerate the login url used for Authorization code flow.
-
azure-devops-pipeline-listRetrieve project pipelines list.
-
azure-devops-pipeline-runRun a pipeline. A DevOps pipeline is a set of automated processes and tools that allows both developers and operations professionals to work cohesively to build and deploy code to a production environment.
-
azure-devops-pipeline-run-getRetrieve information for a pipeline run.
-
azure-devops-pipeline-run-listRetrieve pipeline runs list. The command retrieves up to the top 10000 runs for a particular pipeline.
-
azure-devops-project-listRetrieve all projects in the organization that the authenticated user has access to.
-
azure-devops-project-team-listGet a list of teams.
-
azure-devops-pull-request-commit-listGet the commits for the specified pull request.
-
azure-devops-pull-request-createCreate a new pull request.
-
azure-devops-pull-request-getRetrieve pull-request.
-
azure-devops-pull-request-listRetrieve pull requests in repository.
-
azure-devops-pull-request-reviewer-addAdd a reviewer to a pull request.
-
azure-devops-pull-request-reviewer-listRetrieve the reviewers for a pull request.
-
azure-devops-pull-request-thread-createCreate a thread in a pull request.
-
azure-devops-pull-request-thread-listRetrieve all threads in a pull request.
-
azure-devops-pull-request-thread-updateUpdate a thread in a pull request.
-
azure-devops-pull-request-updateUpdate a pull request. At least one of the following arguments must be provided: title, description, or status.
-
azure-devops-repository-listRetrieve git repositories in the organization project.
-
azure-devops-team-member-listGet a list of members for a specific team.
-
azure-devops-user-addAdd a user, assign the user a license and extensions, and make the user a member of a project group in an account.
-
azure-devops-user-listQuery users that were added to organization projects.
-
azure-devops-user-removeRemove the user from all project memberships.
-
azure-devops-work-item-createCreates a single work item.
-
azure-devops-work-item-getReturns a single work item.
-
azure-devops-work-item-updateUpdates a single work item.
-
get-mapping-fieldsGet mapping fields from remote incident. Please note that this method will not update the current incident. It's here for debugging purposes.
import copy import json from collections.abc import Callable from datetime import datetime from pathlib import Path from typing import NamedTuple import demistomock as demisto # noqa: F401 import urllib3 from CommonServerPython import * # noqa: F401 from MicrosoftApiModule import * # noqa: E402 from requests import Response MISSING_PARAMETERS_ERROR_MSG = ( "One or more arguments are missing." "Please pass with the command: {arguments}" "You can also re-configure the instance and set them as parameters." ) MISSING_PARAMETERS_ERROR_MSG_2 = ( "One or more arguments are missing." "Please pass with the command: repository and project." "You can also re-configure the instance and set them as parameters." ) COMMIT_HEADERS_MAPPING = {"commitId": "Commit ID", "committer": "Committer", "comment": "Comment"} INCIDENT_TYPE_NAME = "Azure DevOps" OUTGOING_MIRRORED_FIELDS = { "status": "The status of the pull request.", "title": "The title of the pull request.", "description": "The description of the pull request.", "project": "The name of the project.", "repository_id": "The repository ID of the pull request target branch.", "pull_request_id": "the ID of the pull request", } GRANT_BY_CONNECTION = { "Device Code": DEVICE_CODE, "Authorization Code": AUTHORIZATION_CODE, "Client Credentials": CLIENT_CREDENTIALS, } SCOPE_DEVICE_AUTH_FLOW = "499b84ac-1321-427f-aa17-267ca6975798/user_impersonation offline_access" SCOPE = "499b84ac-1321-427f-aa17-267ca6975798/.default" DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ" # ISO8601 format with UTC, default in XSOAR class Project(NamedTuple): organization: str repository: str project: str @property def repo_url(self) -> str: return f"https://dev.azure.com/{self.organization}/{self.project}/_apis/git/repositories/{self.repository}" @property def project_url(self) -> str: return f"https://dev.azure.com/{self.organization}/{self.project}" @property def organization_url(self) -> str: return f"https://dev.azure.com/{self.organization}" class Client: """ API Client to communicate with AzureDevOps. """ def __init__( self, client_id: str, organization: str, verify: bool, proxy: bool, auth_type: str, tenant_id: str = None, enc_key: str = None, auth_code: str = None, redirect_uri: str = None, ): if "@" in client_id: # for use in test-playbook client_id, refresh_token = client_id.split("@") integration_context = get_integration_context() integration_context.update(current_refresh_token=refresh_token) set_integration_context(integration_context) client_args = assign_params( self_deployed=True, auth_id=client_id, token_retrieval_url="https://login.microsoftonline.com/organizations/oauth2/v2.0/token" if "Device Code" in auth_type else None, grant_type=GRANT_BY_CONNECTION[auth_type], base_url=f"https://dev.azure.com/{organization}", verify=verify, proxy=proxy, scope=SCOPE if "Device Code" not in auth_type else SCOPE_DEVICE_AUTH_FLOW, tenant_id=tenant_id, enc_key=enc_key, auth_code=auth_code, redirect_uri=redirect_uri, command_prefix="azure-devops", ) self.ms_client = MicrosoftClient(**client_args) self.organization = organization self.connection_type = auth_type def pipeline_run_request(self, project: str, pipeline_id: str, branch_name: str) -> dict: """ Run a pipeline. Args: project (str): The name or the ID of the project. pipeline_id (str): The ID of the pipeline. branch_name (str): The name of the repository branch which run the pipeline. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} data = {"resources": {"repositories": {"self": {"refName": f"refs/heads/{branch_name}"}}}} url_suffix = f"{project}/_apis/pipelines/{pipeline_id}/runs" response = self.ms_client.http_request( method="POST", url_suffix=url_suffix, params=params, json_data=data, resp_type="json" ) return response def user_add_request(self, user_email: str, account_license_type: str, group_type: str, project_id: str) -> dict: """ Add a user, assign license and extensions and make them a member of a project group in an account. Args: user_email (str): The Email of the user to add to the organization. account_license_type (str): The type of account license (e.g. Express, Stakeholder etc.). group_type (str): Project Group (e.g. Contributor, Reader etc.). project_id (str): The ID of the project. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.3"} data = { "accessLevel": {"accountLicenseType": account_license_type}, "projectEntitlements": [{"group": {"groupType": group_type}, "projectRef": {"id": project_id}}], "user": {"principalName": user_email, "subjectKind": "user"}, } full_url = f"https://vsaex.dev.azure.com/{self.organization}/_apis/UserEntitlements" response = self.ms_client.http_request(method="POST", full_url=full_url, params=params, json_data=data, resp_type="json") return response def user_remove_request(self, user_id: str) -> Response: """ Delete a user from the account. Args: user_id (str): The ID of the user to remove from the account. Returns: Response: API response from Azure. """ params = {"api-version": "6.1-preview.3"} full_url = f"https://vsaex.dev.azure.com/{self.organization}/_apis/userentitlements/{user_id}" response = self.ms_client.http_request(method="DELETE", full_url=full_url, params=params, resp_type="response") return response def pull_request_create_request( self, project: str, repository_id: str, source_branch: str, target_branch: str, title: str, description: str, reviewers: list, ) -> dict: """ Create a new pull request in Azure DevOps. Args: project (str): The name or the ID of the project. repository_id (str): The repository ID of the pull request's target branch. source_branch (str): The name of the source branch of the pull request. target_branch (str): The name of the target branch of the pull request. title (str): The title of the pull request. description (str): The description of the pull request. reviewers (list): Pull-request reviewers IDs. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} data = { "sourceRefName": source_branch, "targetRefName": target_branch, "description": description, "reviewers": reviewers, "title": title, } url_suffix = f"{project}/_apis/git/repositories/{repository_id}/pullrequests" response = self.ms_client.http_request( method="POST", url_suffix=url_suffix, params=params, json_data=data, resp_type="json" ) return response def pull_request_update_request( self, project: str, repository_id: str, pull_request_id: str, title: str = None, description: str = None, status: str = None, last_merge_source_commit: dict = None, ) -> dict: """ Update a pull request. Args: project (str): The name or the ID of the project. repository_id (str): The repository ID of the pull request's target branch. pull_request_id (str): The ID of the pull-request. title (str): The updated pull-request title. description (str): The updated pull-request description. status (str): The updated pull-request status. last_merge_source_commit (dict): Commit object at the head of the source branch at the time of the last pull request merge. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} data = remove_empty_elements( {"description": description, "status": status, "title": title, "LastMergeSourceCommit": last_merge_source_commit} ) url_suffix = f"{project}/_apis/git/repositories/{repository_id}/pullrequests/{pull_request_id}" response = self.ms_client.http_request( method="PATCH", url_suffix=url_suffix, params=params, json_data=data, resp_type="json" ) return response def pull_requests_get_request(self, project: str, repository_id: str, pull_request_id: str) -> dict: """ Retrieve pull request information request. Args: project (str): The name or the ID of the project. repository_id (str): The repository ID of the pull request's target branch. pull_request_id (str): The ID of the pull-request. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} url_suffix = f"{project}/_apis/git/repositories/{repository_id}/pullrequests/{pull_request_id}" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="json") return response def pull_requests_list_request( self, project: str | None, repository: str | None, skip: int = None, limit: int = None ) -> dict: """ Retrieve pull requests in repository. Args: project (str | None): The name or the ID of the project. repository (str | None): The repository name of the pull request's target branch. skip (int): The number of results to skip. limit (int): The number of results to retrieve. Returns: dict: API response from Azure. """ params = remove_empty_elements({"api-version": "6.1-preview.1", "$skip": skip, "$top": limit}) url_suffix = f"{project}/_apis/git/repositories/{repository}/pullrequests/" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="json") return response def project_list_request(self, skip: int = None, limit: int = None) -> dict: """ Retrieve all projects in the organization that the authenticated user has access to. Args: skip (int): The number of results to skip. limit (int): The number of results to retrieve. Returns: dict: API response from Azure. """ params = remove_empty_elements({"api-version": "6.1-preview.4", "$skip": skip, "$top": limit}) response = self.ms_client.http_request(method="GET", url_suffix="_apis/projects", params=params, resp_type="json") return response def repository_list_request(self, project: str) -> dict: """ Retrieve git repositories in the organization project. Args: project (str): The name of the project to which the repositories belong to. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} url_suffix = f"{project}/_apis/git/repositories" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="json") return response def users_query_request(self, query: str) -> dict: """ Query users in the organization. Args: query (str): Users or organization query prefix. For example, If we want to retrieve information about the user 'Tom' we can enter the value of this argument as 'Tom'. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} url_suffix = "_apis/IdentityPicker/Identities" data = { "query": query, "identityTypes": ["user", "group"], "operationScopes": ["ims", "source"], "properties": [ "DisplayName", "IsMru", "ScopeName", "SamAccountName", "Active", "SubjectDescriptor", "Department", "JobTitle", "Mail", "MailNickname", "PhysicalDeliveryOfficeName", "SignInAddress", "Surname", "Guest", "TelephoneNumber", "Manager", "Description", ], } response = self.ms_client.http_request( method="POST", url_suffix=url_suffix, params=params, json_data=data, resp_type="json" ) return response def get_pipeline_run_request(self, project: str, pipeline_id: str, run_id: str) -> dict: """ Retrieve pipeline run information. Args: project (str): The name of the project. pipeline_id (str): The ID of the pipeline to retrieve. run_id (str): The ID of the pipeline run to retrieve. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} url_suffix = f"{project}/_apis/pipelines/{pipeline_id}/runs/{run_id}" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="json") return response def pipeline_run_list_request(self, project: str, pipeline_id: str) -> dict: """ Retrieve project pipeline runs list. Args: project (str): The name of the project. pipeline_id (str): The ID of the pipeline to retrieve. Returns: dict: API response from Azure. """ params = {"api-version": "6.1-preview.1"} url_suffix = f"{project}/_apis/pipelines/{pipeline_id}/runs" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="json") return response def pipeline_list_request(self, project: str, limit: int = None, continuation_token: str = None) -> Response: """ Retrieve project pipelines list. Args: project (str): The name of the project. limit (int): The number of results to retrieve. continuation_token (str): A continuation token from a previous request, to retrieve the next page of results. Returns: Response: API response from Azure. """ params = remove_empty_elements({"api-version": "6.1-preview.1", "$top": limit, "continuationToken": continuation_token}) url_suffix = f"{project}/_apis/pipelines" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="response") return response def branch_list_request( self, project: str | None, repository: str | None, limit: int = None, continuation_token: str = None ) -> Response: """ Retrieve repository branches list. Args: project (str | None): The name of the project. repository (str | None): The name of the project repository. limit (int): The number of results to retrieve. continuation_token (str): A continuation token from a previous request, to retrieve the next page of results. Returns: Response: API response from Azure. """ params = remove_empty_elements( {"api-version": "6.1-preview.1", "$top": limit, "continuationToken": continuation_token, "filter": "heads"} ) url_suffix = f"{project}/_apis/git/repositories/{repository}/refs" response = self.ms_client.http_request(method="GET", url_suffix=url_suffix, params=params, resp_type="response") return response def list_pull_requests_reviewers(self, project_args: Project, pull_request_id: Optional[int]): params = {"api-version": 7.0} full_url = f"{project_args.repo_url}/pullRequests/{pull_request_id}/reviewers" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def add_pull_requests_reviewer( self, project_args: Project, pull_request_id: Optional[int], reviewer_user_id: str, is_required: bool ): params = {"api-version": 7.0} data = {"id": reviewer_user_id, "isRequired": is_required, "vote": 0} full_url = f"{project_args.repo_url}/pullRequests/{pull_request_id}/reviewers/{reviewer_user_id}" return self.ms_client.http_request(method="PUT", full_url=full_url, json_data=data, params=params, resp_type="json") def list_pull_requests_commits(self, project_args: Project, pull_request_id: Optional[int], limit: int): params = {"api-version": 7.0, "$top": limit} full_url = f"{project_args.repo_url}/pullRequests/{pull_request_id}/commits" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def list_commits(self, project_args: Project, limit: int, offset: int): params = {"api-version": 7.0, "searchCriteria.$skip": offset, "searchCriteria.$top": limit} full_url = f"{project_args.repo_url}/commits" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def get_commit(self, project_args: Project, commit_id: str): params = {"api-version": 7.0} full_url = f"{project_args.repo_url}/commits/{commit_id}" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def get_work_item(self, project_args: Project, item_id: str): params = {"api-version": 7.0} full_url = f"{project_args.project_url}/_apis/wit/workitems/{item_id}" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def create_work_item(self, project_args: Project, args: Dict[str, Any]): arguments_list = ["title", "iteration_path", "description", "priority", "tag"] data = work_item_pre_process_data(args, arguments_list) params = {"api-version": 7.0} full_url = f'{project_args.project_url}/_apis/wit/workitems/${args["type"]}' return self.ms_client.http_request( method="POST", headers={"Content-Type": "application/json-patch+json"}, full_url=full_url, params=params, json_data=data, resp_type="json", ) def update_work_item(self, project_args: Project, args: Dict[str, Any]): arguments = ["title", "assignee_display_name", "state", "iteration_path", "description", "priority", "tag"] data = work_item_pre_process_data(args, arguments) params = {"api-version": 7.0} full_url = f'{project_args.project_url}/_apis/wit/workitems/{args["item_id"]}' return self.ms_client.http_request( method="PATCH", headers={"Content-Type": "application/json-patch+json"}, full_url=full_url, params=params, json_data=data, resp_type="json", ) def file_request(self, project_args: Project, change_type: str, args: Dict[str, Any]): data = file_pre_process_body_request(change_type, args) params = {"api-version": 7.0} full_url = f"{project_args.repo_url}/pushes" return self.ms_client.http_request(method="POST", full_url=full_url, params=params, json_data=data, resp_type="json") def list_files(self, project_args: Project, args: Dict[str, Any]): params = { "api-version": 7.0, "versionDescriptor.version": args["branch_name"].split("/")[-1], "versionDescriptor.versionType": "branch", "recursionLevel": args["recursion_level"], "includeContentMetadata": True, } full_url = f"{project_args.repo_url}/items" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def get_file(self, project_args: Project, args: Dict[str, Any]): params = { "path": args["file_name"], "api-version": 7.0, "$format": args["format"], "includeContent": args["include_content"], "versionDescriptor.versionType": "branch", "versionDescriptor.version": args["branch_name"].split("/")[-1], } full_url = f"{project_args.repo_url}/items" headers = {"Content-Type": "application/json" if args["format"] == "json" else "application/zip"} return self.ms_client.http_request( method="GET", full_url=full_url, headers=headers, params=params, resp_type="response" if args["format"] == "zip" else "json", ) def create_branch(self, project_args: Project, args: Dict[str, Any]): # initialize new branch - this is the syntax if no reference was given args["branch_id"] = args.get("branch_id") or "0000000000000000000000000000000000000000" data = file_pre_process_body_request("add", args) params = {"api-version": 7.0} full_url = f"{project_args.repo_url}/pushes" return self.ms_client.http_request(method="POST", full_url=full_url, params=params, json_data=data, resp_type="json") def create_pull_request_thread(self, project_args: Project, args: Dict[str, Any]): data = {"comments": [{"parentCommentId": 0, "content": args["comment_text"], "commentType": 1}], "status": 1} params = {"api-version": 7.0} full_url = f'{project_args.repo_url}/pullRequests/{args["pull_request_id"]}/threads' return self.ms_client.http_request(method="POST", full_url=full_url, params=params, json_data=data, resp_type="json") def update_pull_request_thread(self, project_args: Project, args: Dict[str, Any]): data = {"comments": [{"parentCommentId": 0, "content": args["comment_text"], "commentType": 1}], "status": 1} params = {"api-version": 7.0} full_url = f'{project_args.repo_url}/pullRequests/{args["pull_request_id"]}/threads/{args["thread_id"]}' return self.ms_client.http_request(method="PATCH", full_url=full_url, params=params, json_data=data, resp_type="json") def list_pull_request_threads(self, project_args: Project, pull_request_id: str): params = {"api-version": 7.0} full_url = f"{project_args.repo_url}/pullRequests/{pull_request_id}/threads" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def list_project_teams(self, project_args: Project): params = {"api-version": 7.0} full_url = f"https://dev.azure.com/{project_args.organization}/_apis/projects/{project_args.project}/teams" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def list_team_members(self, project_args: Project, args: Dict[str, Any], limit: int, skip: int): params = {"api-version": 7.0, "$skip": skip, "$top": limit} full_url = ( f'https://dev.azure.com/{project_args.organization}/_apis/projects/' f'{project_args.project}/teams/{args["team_id"]}/members' ) return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="json") def get_blob_zip(self, project_args: Project, file_object_id: str): params = {"api-version": 7.0, "$format": "zip"} full_url = f"{project_args.repo_url}/blobs/{file_object_id}" return self.ms_client.http_request(method="GET", full_url=full_url, params=params, resp_type="response") def generate_pipeline_run_output(response: dict, project: str) -> dict: """ Create XSOAR context output for retrieving pipeline run information. Args: response (dict): API response from Azure. project (str): The name of the pipeline project. Returns: dict: XSOAR command outputs. """ outputs = copy.deepcopy(response) created_date = arg_to_datetime(outputs.get("createdDate")) outputs["createdDate"] = created_date.isoformat() if created_date else created_date outputs["run_id"] = outputs.pop("id") outputs["project"] = project outputs["result"] = outputs.get("result", "unknown") return outputs def filter_pipeline_run_table(run: dict) -> dict: """ Filter pipeline-run required information for representing to the user. Args: run (dict): Pipeline-run information. Returns: dict: Filtered pipeline-run information. """ return { "pipeline_id": dict_safe_get(run, ["pipeline", "id"]), "run_state": run.get("state"), "creation_date": run.get("createdDate"), "run_id": run.get("run_id"), "result": run.get("result", "unknown"), } def generate_pipeline_run_readable_information(outputs: Union[dict, list], message: str = "Pipeline Run Information:") -> str: """ Create XSOAR readable output for retrieving pipe-line information. Args: outputs (dict/list): API response from Azure. message (str): XSOAR readable outputs table message. Returns: str: XSOAR readable outputs. """ if not isinstance(outputs, list): outputs = [outputs] readable_table = [] for run in outputs: readable_table.append(filter_pipeline_run_table(run)) readable_output = tableToMarkdown( message, readable_table, headers=["pipeline_id", "run_state", "creation_date", "run_id", "result"], headerTransform=string_to_table_header, ) return readable_output def pipeline_run_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Run a pipeline. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args["project"] pipeline_id = args["pipeline_id"] branch_name = args["branch_name"] should_poll = argToBoolean(args.get("polling", False)) # create new pipeline-run. response = client.pipeline_run_request(project, pipeline_id, branch_name) state = response.get("state") # Running polling flow if should_poll and state != "completed": interval = arg_to_number(args.get("interval")) or 30 timeout = arg_to_number(args.get("timeout")) or 60 run_id = response.get("id") polling_args = {"run_id": run_id, "interval": interval, "scheduled": True, "timeout": timeout, **args} # Schedule poll for the piplenine status scheduled_command = ScheduledCommand( command="azure-devops-pipeline-run-get", next_run_in_seconds=interval, timeout_in_seconds=timeout, args=polling_args ) # Result with scheduled_command only - no update to the war room command_results = CommandResults(scheduled_command=scheduled_command) # Polling flow is done or user did not trigger the polling flow (should_poll = False) else: outputs = generate_pipeline_run_output(response, project) readable_output = generate_pipeline_run_readable_information(outputs) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PipelineRun", outputs_key_field="run_id", outputs=outputs, raw_response=response, ) return command_results def user_add_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Add a user, assign license and extensions and make them a member of a project group in an account. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ user_email = args["user_email"] account_license_type = args["account_license_type"] group_type = args["group_type"] project_id = args["project_id"] response = client.user_add_request(user_email, account_license_type, group_type, project_id) if not dict_safe_get(response, ["operationResult", "isSuccess"]): error = dict_safe_get(response, ["operationResult", "errors"]) if not isinstance(error, list) or not error or len(error) == 0: raise ValueError("Error occurred. API response is not in the appropriate format.") error_message = error[0].get("value") raise DemistoException(error_message) user_information = { "id": dict_safe_get(response, ["userEntitlement", "id"]), "accountLicenseType": dict_safe_get(response, ["userEntitlement", "accessLevel", "accountLicenseType"]), "lastAccessedDate": dict_safe_get(response, ["userEntitlement", "lastAccessedDate"]), } readable_output = tableToMarkdown( "User Information:", user_information, headers=["id", "accountLicenseType", "lastAccessedDate"], headerTransform=pascalToSpace, ) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.User", outputs_key_field="id", outputs=response.get("userEntitlement"), raw_response=response, ) return command_results def user_remove_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Remove the user from all project memberships. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ user_id = args["user_id"] client.user_remove_request(user_id) readable_output = f"User {user_id} was successfully removed from the organization." command_results = CommandResults(readable_output=readable_output) return command_results def filter_pull_request_table(pull_request: dict) -> dict: """ Filter pull-request required information for representing to the user. Args: pull_request (dict): Pull-request information. Returns: dict: Filtered pull-request information. """ return { "repository_id": dict_safe_get(pull_request, ["repository", "id"]), "repository_name": dict_safe_get(pull_request, ["repository", "name"]), "project_id": dict_safe_get(pull_request, ["repository", "project", "id"]), "project_name": dict_safe_get(pull_request, ["repository", "project", "name"]), "pull_request_id": pull_request.get("pullRequestId"), "status": pull_request.get("status"), "title": pull_request.get("title"), "description": pull_request.get("description"), "created_by": dict_safe_get(pull_request, ["createdBy", "displayName"]), "creation_date": pull_request.get("creationDate"), } def generate_pull_request_readable_information(response: Union[dict, list], message: str = "Pull Request Information:") -> str: """ Create XSOAR readable output for retrieving pull-request information. Args: response (dict/list): API response from Azure. message (str): XSOAR readable outputs table message. Returns: str: XSOAR readable outputs. """ if not isinstance(response, list): response = [response] readable_table = [] for pr in response: readable_table.append(filter_pull_request_table(pr)) readable_output = tableToMarkdown( message, readable_table, headers=[ "title", "description", "created_by", "pull_request_id", "repository_name", "repository_id", "project_name", "project_id", "creation_date", ], headerTransform=string_to_table_header, ) return readable_output def pull_request_create_command( client: Client, args: Dict[str, Any], repository: Optional[str], project: Optional[str] ) -> CommandResults: """ Create a new pull-request. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. repository: Azure DevOps repository. project: Azure DevOps project. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project_args = organization_repository_project_preprocess( args=args, organization=None, repository_id=repository, project=project, is_organization_required=False ) project, repository_id = project_args.project, project_args.repository source_branch = args["source_branch"] target_branch = args["target_branch"] title = args["title"] description = args["description"] reviewers_ids = argToList(args.get("reviewers_ids")) reviewers = [{"id": reviewer} for reviewer in reviewers_ids] source_branch = source_branch if source_branch.startswith("refs/") else f"refs/heads/{source_branch}" target_branch = target_branch if target_branch.startswith("refs/") else f"refs/heads/{target_branch}" response = client.pull_request_create_request( project, repository_id, source_branch, target_branch, title, description, reviewers ) outputs = copy.deepcopy(response) created_date = arg_to_datetime(response.get("creationDate")) outputs["creationDate"] = created_date.isoformat() if created_date else created_date readable_output = generate_pull_request_readable_information(outputs) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequest", outputs_key_field="pullRequestId", outputs=outputs, raw_response=response, ) return command_results def pull_request_update_command( client: Client, args: Dict[str, Any], repository: Optional[str], project: Optional[str] ) -> CommandResults: """ Update a pull request. Args: project: Azure DevOps project. repository: Azure DevOps repository. client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project_args = organization_repository_project_preprocess( args=args, repository_id=repository, project=project, is_organization_required=False, organization=None ) project, repository = project_args.project, project_args.repository pull_request_id = args["pull_request_id"] title = args.get("title") description = args.get("description") status = args.get("status") if not (title or description or status): raise Exception("At least one of the arguments: title, description, or status must be provided.") last_merge_source_commit = None if status == "completed": pr_data = client.pull_requests_get_request(project, repository, pull_request_id) last_merge_source_commit = pr_data.get("lastMergeSourceCommit") response = client.pull_request_update_request( project, repository, pull_request_id, title, description, status, last_merge_source_commit ) outputs = copy.deepcopy(response) created_date = arg_to_datetime(response.get("creationDate")) outputs["creationDate"] = created_date.isoformat() if created_date else created_date readable_output = generate_pull_request_readable_information(outputs) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequest", outputs_key_field="pullRequestId", outputs=outputs, raw_response=response, ) return command_results def pull_request_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Retrieve pull-request information. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args["project"] repository_id = args["repository_id"] pull_request_id = args["pull_request_id"] response = client.pull_requests_get_request(project, repository_id, pull_request_id) outputs = copy.deepcopy(response) created_date = arg_to_datetime(response.get("creationDate")) outputs["creationDate"] = created_date.isoformat() if created_date else created_date readable_output = generate_pull_request_readable_information(outputs) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequest", outputs_key_field="pullRequestId", outputs=outputs, raw_response=response, ) return command_results def verify_repository_and_project_argument(repository: Optional[str], project: Optional[str]): if not (repository and project): raise DemistoException(MISSING_PARAMETERS_ERROR_MSG_2) def pull_requests_list_command( client: Client, args: Dict[str, Any], repository: Optional[str], project: Optional[str] ) -> CommandResults: """ Retrieve pull requests in repository. Args: project: Azure DevOps project. repository: Azure DevOps repository. client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args.get("project") or project repository = args.get("repository") or repository verify_repository_and_project_argument(repository, project) page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") offset = (page - 1) * limit response = client.pull_requests_list_request(project, repository, offset, limit) readable_message = f"Pull Request List:\n Current page size: {limit}\n Showing page {page} out of others that may exist." outputs = copy.deepcopy(response.get("value", [])) for pr in outputs: created_date = arg_to_datetime(pr.get("creationDate")) pr["creationDate"] = created_date.isoformat() if created_date else created_date readable_output = generate_pull_request_readable_information(outputs, message=readable_message) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequest", outputs_key_field="pullRequestId", outputs=outputs, raw_response=response, ) return command_results def project_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Retrieve all projects in the organization that the authenticated user has access to. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") offset = (page - 1) * limit response = client.project_list_request(offset, limit) readable_message = f"Project List:\n Current page size: {limit}\n Showing page {page} out others that may exist." outputs = copy.deepcopy(response.get("value", [])) output_headers = ["name", "id", "state", "revision", "visibility", "lastUpdateTime"] for project in outputs: last_updated_time = arg_to_datetime(project.get("lastUpdateTime")) project["lastUpdateTime"] = last_updated_time.isoformat() if last_updated_time is not None else last_updated_time readable_output = tableToMarkdown(readable_message, outputs, headers=output_headers, headerTransform=pascalToSpace) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Project", outputs_key_field="id", outputs=outputs, raw_response=response, ) return command_results def repository_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Retrieve git repositories in the organization project. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args["project"] page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") start = (page - 1) * limit end = start + limit readable_message = f"Repositories List:\n Current page size: {limit}\n Showing page {page} out others that may exist." response = client.repository_list_request(project) outputs = [] if (response_count := response.get("count")) and isinstance(response_count, int) and response_count >= start: min_index = min(response_count, end) for repo in response.get("value", [])[start:min_index]: outputs.append(repo) readable_data = copy.deepcopy(outputs) for repo in readable_data: repo["size (Bytes)"] = repo.pop("size") readable_output = tableToMarkdown( readable_message, readable_data, headers=["id", "name", "webUrl", "size (Bytes)"], headerTransform=pascalToSpace ) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Repository", outputs_key_field="id", outputs=outputs, raw_response=response, ) return command_results def users_query_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Query users in the organization. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ query = args["query"] page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") start = (page - 1) * limit end = start + limit readable_message = f"Users List:\n Current page size: {limit}\n Showing page {page} out others that may exist." response = client.users_query_request(query) outputs = [] results = response.get("results") readable_user_information = [] if results and len(results) > 0: identities = results[0].get("identities") if len(identities) >= start: min_index = min(len(identities), end) for identity in identities[start:min_index]: # Updating the id key as well. identity["id"] = identity.get("localId") outputs.append(identity) if identity.get("localDirectory") == "vsd": readable_user_information.append( { "entityType": identity.get("entityType"), "id": identity.get("localId"), "email": identity.get("signInAddress"), } ) readable_output = tableToMarkdown( readable_message, readable_user_information, headers=["email", "entityType", "id"], headerTransform=pascalToSpace ) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.User", outputs_key_field="id", outputs=outputs, raw_response=response, ) return command_results def pipeline_run_get_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Retrieve pipeline run information. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args["project"] pipeline_id = args["pipeline_id"] run_id = args["run_id"] scheduled = argToBoolean(args.get("scheduled", False)) response = client.get_pipeline_run_request(project, pipeline_id, run_id) # This is part of a scheduled command run state = response.get("state") if scheduled and state != "completed": # schedule next poll scheduled_command = ScheduledCommand( command="azure-devops-pipeline-run-get", next_run_in_seconds=arg_to_number(args.get("interval")) or 30, timeout_in_seconds=arg_to_number(args.get("timeout")) or 60, args=args, ) # result with scheduled_command only - no update to the war room command_results = CommandResults(scheduled_command=scheduled_command) else: outputs = generate_pipeline_run_output(response, project) readable_output = generate_pipeline_run_readable_information(outputs) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PipelineRun", outputs_key_field="run_id", outputs=outputs, raw_response=response, ) return command_results def pipeline_run_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Retrieve project pipeline runs list. The command retrieves up to the top 10000 runs for a particular pipeline. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args["project"] pipeline_id = args["pipeline_id"] page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") start = (page - 1) * limit end = start + limit readable_message = f"Pipeline runs List:\n Current page size: {limit}\n Showing page {page} out others that may exist." readable_output = readable_message response = client.pipeline_run_list_request(project, pipeline_id) outputs = [] if (response_count := response.get("count")) and isinstance(response_count, int) and response_count >= start: min_index = min(response_count, end) for run in response.get("value", [])[start:min_index]: data = generate_pipeline_run_output(run, project) outputs.append(data) readable_output = generate_pipeline_run_readable_information(outputs, message=readable_message) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PipelineRun", outputs_key_field="run_id", outputs=outputs, raw_response=response, ) return command_results def get_pagination_continuation_token(limit: int, page: int, client_request: Callable, args: dict) -> str: """ Get next continuation token for request pagination. Args: limit (): Number of elements to retrieve. page (): Page number. client_request (Callable): Client request function. args (dict): Request function arguments. Returns: str: Continuation token """ offset = limit * (page - 1) response = client_request(limit=offset, **args) return response.headers.get("x-ms-continuationtoken") def pipeline_list_command(client: Client, args: Dict[str, Any]) -> CommandResults: """ Retrieve project pipelines list. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args["project"] page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 readable_message = f"Pipelines List:\n Current page size: {limit}\n Showing page {page} out others that may exist." if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") continuation_token = None if page > 1: continuation_token = get_pagination_continuation_token( limit=limit, page=page, client_request=client.pipeline_list_request, args={"project": project} ) if not continuation_token: return CommandResults( readable_output=readable_message, outputs_prefix="AzureDevOps.Pipeline", outputs=[], raw_response=[] ) response = client.pipeline_list_request(project, limit, continuation_token).json() outputs = copy.deepcopy(response.get("value")) for pipeline in outputs: pipeline["project"] = project readable_output = tableToMarkdown( readable_message, outputs, headers=["id", "name", "revision", "folder"], headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Pipeline", outputs_key_field="id", outputs=outputs, raw_response=response, ) def branch_list_command( client: Client, args: Dict[str, Any], repository: Optional[str], project: Optional[str] ) -> CommandResults: """ Retrieve repository branches list. Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. repository: Azure DevOps repository. project: Azure DevOps project. Returns: CommandResults: outputs, readable outputs and raw response for XSOAR. """ project = args.get("project") or project repository = args.get("repository") or repository verify_repository_and_project_argument(repository, project) page = arg_to_number(args.get("page")) or 1 limit = arg_to_number(args.get("limit")) or 50 readable_message = f"Branches List:\n Current page size: {limit}\n Showing page {page} out others that may exist." if page < 1 or limit < 1: raise Exception("Page and limit arguments must be greater than 1.") continuation_token = None if page > 1: continuation_token = get_pagination_continuation_token( limit=limit, page=page, client_request=client.branch_list_request, args={"project": project, "repository": repository} ) if not continuation_token: return CommandResults( readable_output=readable_message, outputs_prefix="AzureDevOps.Branch", outputs_key_field="name", outputs=[], raw_response=[], ) response = client.branch_list_request(project, repository, limit, continuation_token).json() outputs = copy.deepcopy(response.get("value", [])) for branch in outputs: branch["project"] = project branch["repository"] = repository readable_output = tableToMarkdown( readable_message, outputs, headers=["name", "objectId"], headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Branch", outputs_key_field="name", outputs=outputs, raw_response=response, ) # --Mirroring Commands-- def get_update_args(delta: dict, data: dict) -> dict: """ Change the updated field names to fit the pull-request update command. Args: delta (dict): Updated fields from XSOAR incident mirroring. data (dict): Incident source fields from XSOAR incident mirroring. Returns: dict: Updated argument information. """ arguments = { "project": data.get("project"), "repository_id": data.get("repository_id"), "pull_request_id": data.get("pull_request_id"), "title": delta.get("title"), "description": delta.get("description"), "status": delta.get("status"), } return arguments def update_remote_system_command(client: Client, args: Dict[str, Any], repository: Optional[str], project: Optional[str]) -> str: """ Pushes local changes to the remote system Args: client (Client): Azure DevOps API client. args (dict): Command arguments from XSOAR. args['data']: the data to send to the remote system args['entries']: the entries to send to the remote system args['incident_changed']: boolean telling us if the local incident indeed changed or not args['remote_incident_id']: the remote incident id repository: The Azure DevOps repository name. project: The Azure DevOps project name. Returns: str: The new ID of the updated incident. """ remote_args = UpdateRemoteSystemArgs(args) if remote_args.delta: demisto.debug( f"Got the following delta keys {list(remote_args.delta.keys())!s} to update Azure DevOps " f"incident {remote_args.remote_incident_id}" ) else: demisto.debug("There is no delta fields in Azure DevOps\n") try: if remote_args.incident_changed: update_args = get_update_args(remote_args.delta, remote_args.data) demisto.debug(f"Sending incident with remote ID [{remote_args.remote_incident_id}] to Azure DevOps\n") pull_request_update_command(client, update_args, repository=repository, project=project) else: demisto.debug( f"Skipping updating remote incident fields [{remote_args.remote_incident_id}] as it is not new nor changed" ) except Exception as e: demisto.info( f"Error in Azure DevOps outgoing mirror for incident {remote_args.remote_incident_id} \nError message: {e!s}" ) finally: return remote_args.remote_incident_id def get_mapping_fields_command() -> GetMappingFieldsResponse: """ Returns the list of fields for an incident type. """ incident_type_scheme = SchemeTypeMapping(type_name=INCIDENT_TYPE_NAME) demisto.debug(f'Collecting incident mapping for incident type - "{INCIDENT_TYPE_NAME}"') for argument, description in OUTGOING_MIRRORED_FIELDS.items(): incident_type_scheme.add_field(name=argument, description=description) mapping_response = GetMappingFieldsResponse() mapping_response.add_scheme_type(incident_type_scheme) return mapping_response # --Authorization Commands-- def start_auth(client) -> CommandResults: result = client.ms_client.start_auth("!azure-devops-auth-complete") return CommandResults(readable_output=result) def complete_auth(client) -> str: client.ms_client.get_access_token() return "Authorization completed successfully." def test_connection(client) -> str: try: client.ms_client.get_access_token() except Exception as err: return f"Authorization Error: \n{err}" return "Success!" def parse_incident(pull_request: dict, integration_instance: str) -> dict: """ Parse pull request to XSOAR Incident. Args: pull_request (dict): Pull-request information. integration_instance (str): The name of the integration instance. Returns: dict: XSOAR Incident. """ incident_data = filter_pull_request_table(pull_request) incident_data["mirror_direction"] = "Out" incident_data["mirror_instance"] = integration_instance incident = { "name": "Azure DevOps - Pull request ID: " + str(incident_data.get("pull_request_id")), "rawJSON": json.dumps(incident_data), } return incident def count_active_pull_requests(project: str, repository: str, client: Client, first_fetch: str | datetime | None = None) -> int: """ Count the number of active pull-requests in the repository. Args: project (str): The name of the project which the pull requests belongs to. repository (str): The repository name of the pull request's target branch. client (Client): Azure DevOps API client. first_fetch (datetime): Indicated the oldest pull-request time. Returns: int: Pull-requests number. """ count = 0 limit = 100 max_iterations = 100 while max_iterations > 0: max_iterations -= 1 response = client.pull_requests_list_request(project, repository, skip=count, limit=limit) if response.get("count", 0) == 0: break if first_fetch: last_pr_date_str = response.get("value", [])[response.get("count", 0) - 1].get("creationDate").replace("Z", "") last_pr_date = arg_to_datetime(last_pr_date_str) if last_pr_date_str else None if last_pr_date and isinstance(first_fetch, datetime) and last_pr_date < first_fetch: # If the oldest pr in the result is older than 'first_fetch' argument. for pr in response.get("value", []): creation_date_str = pr.get("creationDate", "").replace("Z", "") creation_date = arg_to_datetime(creation_date_str) if creation_date_str else None if creation_date and isinstance(first_fetch, datetime) and creation_date > first_fetch: count += 1 else: # Stop counting max_iterations = -1 break else: count += response.get("count", 0) else: count += response.get("count", 0) return count def get_last_fetch_incident_index(project: str, repository: str, client: Client, last_id: int): """ Retrieve the index of the last fetched pull-request. index if the pull request is no active anymore - return -1. Args: project (str): The name of the project which the pull requests belongs to. repository (str): The repository name of the pull request's target branch. client (Client): Azure DevOps API client. last_id (int): Last fetch pull-request ID. Returns: int: Last fetched pull-request. """ count = 0 limit = 100 max_iterations = 100 while max_iterations > 0: response = client.pull_requests_list_request(project, repository, skip=count, limit=limit) if response.get("count", 0) == 0: break pr_ids = [pr.get("pullRequestId") for pr in response.get("value", [])] if last_id in pr_ids: return pr_ids.index(last_id) + count else: if max(pr_ids) < last_id: break count += response.get("count", 0) max_iterations -= 1 return -1 def get_closest_index(project: str, repository: str, client: Client, last_id: int) -> int: """ This method used for find the closest index to the last fetched pull-request ID. This method is used to find the ID of the next pull-request after the last_id. The correctness of the method stems from the fact that the pull-request ID is an incremental number, and from the way the pull-requests are retrieved from the API. Args: project (str): The name of the project which the pull requests belongs to. repository (str): The repository name of the pull request's target branch. client (Client): Azure DevOps API client. last_id (int): Last fetch pull-request ID. Returns: int: Closest index to the last fetched pull-request ID. """ count = 0 limit = 100 max_iterations = 100 while max_iterations > 0: response = client.pull_requests_list_request(project, repository, skip=count, limit=limit) if response.get("count", 0) == 0: break pr_ids = [pr.get("pullRequestId") for pr in response.get("value", [])] min_id = min(pr_ids) max_id = max(pr_ids) if min_id < last_id < max_id: # The closest index is in this page. closest_id = -1 for pr_id in pr_ids: if pr_id < last_id: break closest_id = pr_id return pr_ids.index(closest_id) + count elif max_id < last_id: # The closest index is in the previous page. return count - 1 else: count += response.get("count", 0) max_iterations -= 1 if response.get("count", 0) == 0: break return -1 def is_new_pr(project: str, repository: str, client: Client, last_id: int) -> bool: """ Validate if there is new pull-request in the repository. Args: project (str): The name of the project which the pull requests belongs to. repository (str): The repository name of the pull request's target branch. client (Client): Azure DevOps API client. last_id (int): Last fetch pull-request ID. Returns: bool: True if there is new pull-request in the repository, otherwise False. """ response = client.pull_requests_list_request(project, repository, skip=0, limit=1) num_prs = response.get("count", 0) last_pr_id = response.get("value", [])[0].get("pullRequestId", 0) if len(response.get("value", [])) > 0 else None if num_prs == 0 or last_pr_id <= last_id: # type: ignore[operator] demisto.debug(f"Number of PRs is: {num_prs}. Last fetched PR id: {last_pr_id}") return False return True def file_pre_process_body_request(change_type: str, args: Dict[str, Any]) -> dict: # pre-process branch branch_name = args["branch_name"] branch_id = args["branch_id"] branch_details = [{"name": branch_name, "oldObjectId": branch_id}] # pre-process commit comment = args["commit_comment"] file_path = args.get("file_path", "") file_content = args.get("file_content", "") # validate file_path exists (explicitly or entry_id), file_content can be empty entry_id = args.get("entry_id", "") if not (entry_id or file_path): raise DemistoException('specify either the "file_path" or the "entry_id" of the file.') # Take the given arguments, not the entry id, if file_path and entry_id are passed. Otherwise, take the entry id. if not file_path: file_path = demisto.getFilePath(entry_id)["path"] file_content = Path(file_path).read_text() changes = {"changeType": change_type, "item": {"path": file_path}} # in case of add/edit (create/update), add another key with the new content if change_type != "delete": changes["newContent"] = {"content": file_content, "contentType": "rawtext"} commits = [{"comment": comment, "changes": [changes]}] data = {"refUpdates": branch_details, "commits": commits} return data def pagination_preprocess_and_validation(args: Dict[str, Any]) -> tuple[int, int]: """ Ensure the pagination values are valid. """ limit = arg_to_number(args.get("limit")) or 50 page = arg_to_number(args.get("page")) or 1 if page < 1 or limit < 1: raise ValueError("Page and limit arguments must be at least 1.") return limit, (page - 1) * limit def organization_repository_project_preprocess( args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str], is_repository_id_required: bool = True, is_organization_required: bool = True, ) -> Project: """ The organization, repository and project are preprocessed by this function. """ # Those arguments are already set as parameters, but the user can override them. organization = args.get("organization_name") or organization repository_id = args.get("repository_id") or repository_id project = args.get("project_name") or project missing_arguments = [] # validate those arguments exist if is_organization_required and not organization: missing_arguments.append("organization name") if is_repository_id_required and not repository_id: missing_arguments.append("repository_id / repository") if not project: missing_arguments.append("project") if missing_arguments: raise DemistoException(MISSING_PARAMETERS_ERROR_MSG.format(arguments=", ".join(missing_arguments))) # Validation in organization, project and repository ensures the right type is passed return Project(organization=organization, repository=repository_id, project=project) # type:ignore[arg-type] def pull_request_reviewer_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Retrieve the reviewers for a pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) pull_request_id = arg_to_number(args.get("pull_request_id")) response = client.list_pull_requests_reviewers(project_args, pull_request_id) mapping = {"displayName": "Reviewer(s)", "hasDeclined": "Has Declined", "isFlagged": "Is Flagged"} readable_output = tableToMarkdown( "Reviewers List", response["value"], headers=["displayName", "hasDeclined", "isFlagged"], headerTransform=lambda header: mapping.get(header, header), ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequestReviewer", outputs_key_field="displayName", outputs=response["value"], raw_response=response, ) def pull_request_reviewer_add_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Add a reviewer to a pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) pull_request_id = arg_to_number(args.get("pull_request_id")) reviewer_user_id = args["reviewer_user_id"] # reviewer_user_id is required is_required = args.get("is_required", False) response = client.add_pull_requests_reviewer(project_args, pull_request_id, reviewer_user_id, is_required) readable_output = ( f'{response.get("displayName", "")} ({response.get("id", "")}) was created successfully as a reviewer for' f' Pull Request ID {pull_request_id}.' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequestReviewer", outputs=response, raw_response=response ) def pull_request_commit_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Get the commits for the specified pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) pull_request_id = arg_to_number(args.get("pull_request_id")) # pagination limit, offset = pagination_preprocess_and_validation(args) response = client.list_pull_requests_commits(project_args, pull_request_id, limit) readable_output = tableToMarkdown( "Commits", response.get("value"), headers=["comment", "commitId", "committer"], headerTransform=lambda header: COMMIT_HEADERS_MAPPING.get(header, header), ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Commit", outputs=response.get("value"), raw_response=response ) def commit_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Get the commits for the specified pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) # pagination limit, offset = pagination_preprocess_and_validation(args) response = client.list_commits(project_args, limit, offset) readable_output = tableToMarkdown( "Commits", response.get("value"), headers=["comment", "commitId", "committer"], headerTransform=lambda header: COMMIT_HEADERS_MAPPING.get(header, header), ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Commit", outputs=response.get("value"), raw_response=response ) def commit_get_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Retrieve a particular commit. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) commit_id = args["commit_id"] response = client.get_commit(project_args, commit_id) readable_output = tableToMarkdown( "Commit Details", response, headers=["comment", "commitId", "committer"], headerTransform=lambda header: COMMIT_HEADERS_MAPPING.get(header, header), ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Commit", outputs=response, raw_response=response ) def work_item_get_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Returns a single work item. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) item_id = args["item_id"] response = client.get_work_item(project_args, item_id) response_for_hr = { "ID": response.get("id"), "Title": response.get("fields", {}).get("System.Title"), "Assigned To": response.get("fields", {}).get("System.AssignedTo", {}).get("displayName"), "State": response.get("fields", {}).get("System.State"), "Area Path": response.get("fields", {}).get("System.AreaPath"), "Tags": response.get("fields", {}).get("System.Tags"), "Activity Date": response.get("fields", {}).get("System.ChangedDate"), } readable_output = tableToMarkdown("Work Item Details", response_for_hr) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.WorkItem", outputs=response, raw_response=response ) def work_item_pre_process_data(args: Dict[str, Any], arguments_list: List[str]) -> List[dict]: """ This function pre-processes the data before sending it to the body. """ mapping = { "title": "System.Title", "iteration_path": "System.IterationPath", "description": "System.Description", "priority": "Microsoft.VSTS.Common.Priority", "tag": "System.Tags", "assignee_display_name": "System.AssignedTo", "state": "System.State", } data: List[dict] = [] data.extend( { "op": "add", "path": f"/fields/{mapping[argument]}", "from": None, "value": f"{args.get(argument)}", } for argument in arguments_list if args.get(argument) ) return data def work_item_create_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Creates a single work item. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.create_work_item(project_args, args) readable_output = f'Work Item {response["id"]} was created successfully.' return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.WorkItem", outputs=response, raw_response=response ) def work_item_update_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Updates a single work item. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.update_work_item(project_args, args) readable_output = f'Work Item {response.get("id")} was updated successfully.' return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.WorkItem", outputs=response, raw_response=response ) def extract_branch_id_and_validate_for_files_commands(client: Client, args: Dict[str, Any], project_args: Project): """ Extract the branch id by the given branch name. In case of None, raise an exception since branch does not exist. """ if branch_id := mapping_branch_name_to_branch_id(client, args, project_args): return branch_id raise DemistoException(f'The given branch {args["branch_name"]} does not exist.') def file_create_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Add a file to the repository. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) args["branch_id"] = extract_branch_id_and_validate_for_files_commands(client, args, project_args) response = client.file_request(project_args, change_type="add", args=args) readable_output = ( f'Commit "{response["commits"][0].get("comment")}" was created and pushed successfully by ' f'"{response.get("pushedBy", {}).get("displayName")}" to branch "{args.get("branch_name")}".' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.File", outputs=response, raw_response=response ) def file_update_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Update a file in the repository. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) args["branch_id"] = extract_branch_id_and_validate_for_files_commands(client, args, project_args) response = client.file_request(project_args, change_type="edit", args=args) readable_output = ( f'Commit "{response.get("commits", [])[0].get("comment")}" was updated successfully by ' f'"{response.get("pushedBy", {}).get("displayName")}" in branch "{args.get("branch_name")}".' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.File", outputs=response, raw_response=response ) def file_delete_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Delete a file in the repository. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) args["branch_id"] = extract_branch_id_and_validate_for_files_commands(client, args, project_args) response = client.file_request(project_args, change_type="delete", args=args) readable_output = ( f'Commit "{response.get("commits", [])[0].get("comment")}" was deleted successfully by ' f'"{response.get("pushedBy", {}).get("displayName")}" in branch "{args.get("branch_name")}".' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.File", outputs=response, raw_response=response ) def file_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Retrieve repository files (items) list. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.list_files(project_args, args=args) mapping = { "path": "File Name(s)", "objectId": "Object ID", "commitId": "Commit ID", "gitObjectType": "Object Type", "isFolder": "Is Folder", } readable_output = tableToMarkdown( "Files", response.get("value"), headers=["path", "objectId", "commitId", "gitObjectType", "isFolder"], headerTransform=lambda header: mapping.get(header, header), ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.File", outputs=response.get("value"), raw_response=response ) def file_get_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> list: """ Getting the file. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.get_file(project_args, args=args) file_name = Path(args["file_name"]).name if args["format"] == "json": mapping = {"path": "File Name(s)", "objectId": "Object ID", "commitId": "Commit ID"} readable_output = tableToMarkdown( "Files", response, headers=["path", "objectId", "commitId"], headerTransform=lambda header: mapping.get(header, header), ) command_results = CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.File", outputs=response, raw_response=response ) return [command_results, fileResult(filename=file_name, data=response["content"], file_type=EntryType.ENTRY_INFO_FILE)] # in case args["format"] == 'zip' return [fileResult(filename=file_name, data=response.content, file_type=EntryType.FILE)] def mapping_branch_name_to_branch_id(client: Client, args: Dict[str, Any], project_args: Project): """ This function converts a branch name to branch id. If the given branch does not exist, returns None. """ branch_list = branch_list_command(client, args, project_args.repository, project_args.project) for branch in branch_list.outputs: # type: ignore[union-attr, attr-defined] # two places call this function, one has target_ref as an argument, the other has branch_name if branch.get("name").endswith(args.get("target_ref", args.get("branch_name"))): return branch.get("objectId") return None def branch_create_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Create a branch. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) # convert target_ref to branch id if args.get("target_ref"): args["branch_id"] = mapping_branch_name_to_branch_id(client, args, project_args) response = client.create_branch(project_args, args=args) # For deleting this redundant file, we re-set the reference to be itself in case the new branch came from a reference branch. if args.get("target_ref"): args["target_ref"] = args["branch_name"] # Delete the file was created for the new branch. file_delete_command( client=client, args=args, organization=project_args.organization, repository_id=project_args.repository, project=project_args.project, ) readable_output = ( f'Branch {response.get("refUpdates", [])[0].get("name")} was created successfully by' f' {response.get("pushedBy", {}).get("displayName")}.' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Branch", outputs=response, raw_response=response ) def pull_request_thread_create_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Create a thread in a pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.create_pull_request_thread(project_args, args=args) readable_output = ( f'Thread {response.get("id")} was created successfully by' f' {response.get("comments", [])[0].get("author", {}).get("displayName")}.' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequestThread", outputs=response, raw_response=response ) def pull_request_thread_update_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Update a thread in a pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.update_pull_request_thread(project_args, args=args) readable_output = ( f'Thread {response.get("id")} was updated successfully by' f' {response.get("comments", [])[0].get("author", {}).get("displayName")}.' ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequestThread", outputs=response, raw_response=response ) def pull_request_thread_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> CommandResults: """ Retrieve all threads in a pull request. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.list_pull_request_threads(project_args, args["pull_request_id"]) list_to_table: List[dict] = [] for thread in response.get("value", []): thread_id = thread.get("id") list_to_table.extend( { "Thread ID": thread_id, "Content": comment.get("content"), "Name": comment.get("author").get("displayName"), "Date": comment.get("publishedDate"), } for comment in thread.get("comments") ) readable_output = tableToMarkdown("Threads", list_to_table, headers=["Thread ID", "Content", "Name", "Date"]) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.PullRequestThread", outputs=response.get("value"), raw_response=response, ) def project_team_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], project: Optional[str] ) -> CommandResults: """ Get a list of teams. """ # pre-processing inputs project_args = organization_repository_project_preprocess( args, organization, repository_id=None, project=project, is_repository_id_required=False ) response = client.list_project_teams(project_args) mapping = {"name": "Name"} readable_output = tableToMarkdown( "Teams", response.get("value"), headers=["name"], headerTransform=lambda header: mapping.get(header, header), ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.Team", outputs=response.get("value"), raw_response=response ) def team_member_list_command( client: Client, args: Dict[str, Any], organization: Optional[str], project: Optional[str] ) -> CommandResults: """ Get a list of members for a specific team. """ # pre-processing inputs project_args = organization_repository_project_preprocess( args, organization, repository_id=None, project=project, is_repository_id_required=False ) # pagination limit, offset = pagination_preprocess_and_validation(args) response = client.list_team_members(project_args, args, limit, offset) list_for_hr: List[dict] = [] list_for_hr.extend( { "Name": member.get("identity").get("displayName"), "User ID": member.get("identity").get("id"), "Unique Name": member.get("identity").get("uniqueName"), } for member in response.get("value") ) readable_output = tableToMarkdown( "Team Members", list_for_hr, headers=["Name", "Unique Name", "User ID"], ) return CommandResults( readable_output=readable_output, outputs_prefix="AzureDevOps.TeamMember", outputs=response.get("value"), raw_response=response, ) def blob_zip_get_command( client: Client, args: Dict[str, Any], organization: Optional[str], repository_id: Optional[str], project: Optional[str] ) -> dict: """ Get a single blob. """ # pre-processing inputs project_args = organization_repository_project_preprocess(args, organization, repository_id, project) response = client.get_blob_zip(project_args, args["file_object_id"]) return fileResult(filename=f'{args["file_object_id"]}.zip', data=response.content, file_type=EntryType.FILE) def fetch_incidents( client, project: str, repository: str, integration_instance: str, max_fetch: int = 50, first_fetch: str | None | datetime = None, ) -> None: """ Fetch new active pull-requests from repository. Args: client (Client): Azure DevOps API client. project (str): The name of the project which the pull requests belongs to. repository (str): The repository name of the pull request's target branch. integration_instance (str): The name of the integration instance. max_fetch (int): Maximum incidents for one fetch. first_fetch (str): Indicated the date from which to start fetching pull-requests. """ last_run = demisto.getLastRun() last_id = last_run.get("last_id", None) if last_id: if not is_new_pr(project, repository, client, last_id): # There is no new pr demisto.incidents([]) return last_id_index = get_last_fetch_incident_index(project, repository, client, last_id) if last_id_index == -1: # Last pull-request state is no-active last_id_index = get_closest_index(project, repository, client, last_id) + 1 else: # In the first iteration of fetch-incident , # we have to find the oldest active pull-request index. if first_fetch: first_fetch = arg_to_datetime(first_fetch) last_id_index = count_active_pull_requests(project, repository, client, first_fetch) skip = last_id_index - max_fetch if skip <= 0: skip = 0 max_fetch = last_id_index response = client.pull_requests_list_request(project, repository, skip=skip, limit=max_fetch) pr_data = reversed(response.get("value")) last = None incidents = [] for pr in pr_data: incidents.append(parse_incident(pr, integration_instance)) last = pr.get("pullRequestId") if last: demisto.setLastRun({"last_id": last}) demisto.incidents(incidents) def test_module(client: Client) -> str: """Tests API connectivity and authentication' Returning 'ok' indicates that the integration works like it is supposed to. Connection to the service is successful. Raises exceptions if something goes wrong. :type client: ``Client`` :param Client: client to use :return: 'ok' if test passed. :rtype: ``str`` """ # This should validate all the inputs given in the integration configuration panel, # either manually or by using an API that uses them. if "Device" in client.connection_type: raise DemistoException( "Please enable the integration and run `!azure-devops-auth-start`" "and `!azure-deops-auth-complete` to log in." "You can validate the connection by running `!azure-devops-auth-test`\n" "For more details press the (?) button." ) elif client.connection_type == "Client Credentials": client.ms_client.get_access_token() return "ok" else: raise Exception( "When using user auth flow configuration, " "Please enable the integration and run the !azure-devops-auth-test command in order to test it" ) def main() -> None: params: Dict[str, Any] = demisto.params() args: Dict[str, Any] = demisto.args() client_id = params["client_id"] organization = params["organization"] repository = params.get("repository") project = params.get("project") verify_certificate: bool = not params.get("insecure", False) proxy = params.get("proxy", False) is_mirroring = params.get("is_mirroring", False) tenant_id = params.get("tenant_id") auth_type = params.get("auth_type", "Device") auth_code = params.get("auth_code", {}).get("password", "") redirect_uri = params.get("redirect_uri") enc_key = params.get("credentials", {}).get("password", "") command = demisto.command() demisto.debug(f"Command being called is {command}") try: urllib3.disable_warnings() client: Client = Client( client_id=client_id, organization=organization, verify=verify_certificate, proxy=proxy, auth_type=auth_type, tenant_id=tenant_id, enc_key=enc_key, auth_code=auth_code, redirect_uri=redirect_uri, ) if command == "azure-devops-generate-login-url": return_results(generate_login_url(client.ms_client)) elif command == "azure-devops-auth-start": return_results(start_auth(client)) elif command == "azure-devops-auth-complete": return_results(complete_auth(client)) elif command == "azure-devops-auth-test": return_results(test_connection(client)) elif command == "azure-devops-user-add": return_results(user_add_command(client, args)) elif command == "azure-devops-user-remove": return_results(user_remove_command(client, args)) elif command == "azure-devops-pull-request-create": return_results(pull_request_create_command(client, args, repository, project)) elif command == "azure-devops-pull-request-get": return_results(pull_request_get_command(client, args)) elif command == "azure-devops-pull-request-update": return_results(pull_request_update_command(client, args, repository, project)) elif command == "azure-devops-pull-request-list": return_results(pull_requests_list_command(client, args, repository, project)) elif command == "azure-devops-project-list": return_results(project_list_command(client, args)) elif command == "azure-devops-repository-list": return_results(repository_list_command(client, args)) elif command == "azure-devops-user-list": return_results(users_query_command(client, args)) elif command == "azure-devops-pipeline-run-get": return_results(pipeline_run_get_command(client, args)) elif command == "azure-devops-pipeline-run-list": return_results(pipeline_run_list_command(client, args)) elif command == "azure-devops-pipeline-list": return_results(pipeline_list_command(client, args)) elif command == "azure-devops-branch-list": return_results(branch_list_command(client, args, repository, project)) elif command == "test-module": return_results(test_module(client)) elif command == "fetch-incidents": integration_instance = demisto.integrationInstance() fetch_incidents( client, params.get("project", ""), params.get("repository", ""), integration_instance, arg_to_number(params.get("max_fetch")) or 50, params.get("first_fetch", ""), ) elif command == "azure-devops-auth-reset": return_results(reset_auth()) elif command == "azure-devops-pipeline-run": return_results(pipeline_run_command(client, args)) elif command == "get-mapping-fields": return_results(get_mapping_fields_command()) elif command == "update-remote-system": if is_mirroring: return_results(update_remote_system_command(client, args, repository, project)) elif command == "azure-devops-pull-request-reviewer-list": return_results(pull_request_reviewer_list_command(client, args, organization, repository, project)) elif command == "azure-devops-pull-request-reviewer-add": return_results(pull_request_reviewer_add_command(client, args, organization, repository, project)) elif command == "azure-devops-pull-request-commit-list": return_results(pull_request_commit_list_command(client, args, organization, repository, project)) elif command == "azure-devops-commit-list": return_results(commit_list_command(client, args, organization, repository, project)) elif command == "azure-devops-commit-get": return_results(commit_get_command(client, args, organization, repository, project)) elif command == "azure-devops-work-item-get": return_results(work_item_get_command(client, args, organization, repository, project)) elif command == "azure-devops-work-item-create": return_results(work_item_create_command(client, args, organization, repository, project)) elif command == "azure-devops-work-item-update": return_results(work_item_update_command(client, args, organization, repository, project)) elif command == "azure-devops-file-create": return_results(file_create_command(client, args, organization, repository, project)) elif command == "azure-devops-file-update": return_results(file_update_command(client, args, organization, repository, project)) elif command == "azure-devops-file-delete": return_results(file_delete_command(client, args, organization, repository, project)) elif command == "azure-devops-file-list": return_results(file_list_command(client, args, organization, repository, project)) elif command == "azure-devops-file-get": return_results(file_get_command(client, args, organization, repository, project)) elif command == "azure-devops-branch-create": return_results(branch_create_command(client, args, organization, repository, project)) elif command == "azure-devops-pull-request-thread-create": return_results(pull_request_thread_create_command(client, args, organization, repository, project)) elif command == "azure-devops-pull-request-thread-update": return_results(pull_request_thread_update_command(client, args, organization, repository, project)) elif command == "azure-devops-pull-request-thread-list": return_results(pull_request_thread_list_command(client, args, organization, repository, project)) elif command == "azure-devops-project-team-list": return_results(project_team_list_command(client, args, organization, project)) elif command == "azure-devops-team-member-list": return_results(team_member_list_command(client, args, organization, project)) elif command == "azure-devops-blob-zip-get": return_results(blob_zip_get_command(client, args, organization, repository, project)) else: raise NotImplementedError(f"{command} command is not implemented.") except Exception as e: demisto.error(traceback.format_exc()) if isinstance(e, NotFoundError): err = f"{e!s}. There is a possibility that the organization's name is incorrect" else: err = str(e) return_error(err) if __name__ in ("__main__", "__builtin__", "builtins"): main()