Let's review the process in a summarized way. First, we need to register an app in Azure portal to allow iHub to connect to the Azure DevOps instance. This is done by adding an app and assigning the scopes that allow the connection to read resources like projects and repos. Then we need to enter the credentials from the app into iHub Credentials in an OAuth2 configuration and connect to the app. Once this is done, we can now read the resources from Azure DevOps. Now it is time to set up an asset import to push data to assets. This is done easiest by using the wizard and selecting a generic import. The generic import gives us the skeleton but will require modifications to adjust to the data we want to import. In the documentation, there is a template ready for that.
...
Expand |
---|
title | Add OAuth 2 app in iHub |
---|
|
Open iHub Cloud Select Credentials Click Create and select OAuth and enter a name Copy the callback URL we will need that for the Azure app
Image Added |
Expand |
---|
|
Goto https://portal.azure.com/ and login Click on App registrations
Image Added Click on view API Permission
Add the scope needed, we added these Image Added
Scope and rest doc https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-7.1&tabs=HTTP#security Click Enterprise applications in the bottom Image AddedClick the big blue button: Grant admin consent Image AddedClick on Authentications menu.
Image AddedClick Add Platform and select Web Enter a redirect URL. Add the url to iHub as stated in the OAuth credential page. Image AddedClick on Overview and click on the Endpoints this will display all endpoints needed for your instance Go to Certificates & secrets and click on new Client secret to generate the client secret. Copy the VALUE and save it (it will only be shown one time) Click on Overview copy the Client ID
|
Expand |
---|
title | Add secret to iHub from the Azure App |
---|
|
Go back to iHub Cloud and select Credential created in the first part Click the “Click here to Authorize” button to get the first access token. |
Expand |
---|
title | SETUP THE INTEGRATION CALLS |
---|
|
Click the three dots in next to the +Create Integration button. Select Wizard Select Jira Service Management Select Asset Generic API Import
Image AddedFollow the wizard and select the schema where the asset objects will be imported Open the Integration Select the Update Import Mapping
Image AddedPaste this mapping file into the body of “Update import mapping” Add a action called “Get Devops projects” Configure it to do a GET to https://dev.azure.com/rixterdev/_apis/projects?api-version=7.1 where rixterdev is the url to your devops instance. Update the Submit Data action to have this body Code Block |
---|
{
"data":{
"projects":{{{toJSON value}}}
}
} |
Create a action and place it under “Get Devops projects” call it “Get Repo for Project” Configure it to do a GET to https://dev.azure.com/rixterdev/{{payload.id}}/_apis/git/repositories?api-version=7.1 note the mustache payload syntax in the url Click advanced tab and enter $.value as iteration JSON path Copy the Submit Data and place the new copy under the “Get Repo for Project” Update the body of Submit Repo Data to be Code Block |
---|
{
"data":{
"repos":{{{toJSON value}}}
}
} |
|
Reference API
https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-apis
https://developer.microsoft.com/en-us/graph/graph-explorer
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/repositories/list?view=azure-devops-rest-7.1&tabs=HTTP#security
https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/list?view=azure-devops-rest-7.1&tabs=HTTP