'Create repositories in Azure DevOps from Power Automate

I have a Power Automate flow that receives data from a Microsoft Forms. From this form, I want to create a work item in Azure DevOps but also a repository.

I have bought the Premium version of Azure DevOps Connector that allows me to create the work item that costs £11/month.

enter image description here

There is no options for creating a repo but only to obtain the list of repo.

How can I create the repository? Is there an API for it?



Solution 1:[1]

Power Automate supports the actions as the docs show : Power Automate Actions.

The actions do not include creating repositories in DevOps. You can try to use the REST API to create a repository.

Sample Request

POST https://dev.azure.com/{organiztion}/_apis/git/repositories?api-version=6.0

Request Body

{
  "name": "Repository",
  "project": {
    "id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c"
  }
}

Sample Response

{
  "id": "5febef5a-833d-4e14-b9c0-14cb638f91e6",
  "name": "Repository",
  "url": "https://dev.azure.com/fabrikam/_apis/git/repositories/5febef5a-833d-4e14-b9c0-14cb638f91e6",
  "project": {
    "id": "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
    "name": "Git",
    "url": "https://dev.azure.com/{organiztion}/_apis/projects/6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c",
    "state": "wellFormed"
  },
  "remoteUrl": "https://dev.azure.com/{organiztion}/Git/_git/Repository"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kangcheng Jin-MSFT