Mobile Center with Azure Pipelines



It is possible to integrate Mobile Center with Azure DevOps Pipelines? Or any other hosted CI/CD service?


When using CI/CD cloud/hosted services, it is becomes an obvious that the generated artefacts should be published for Continuous Testing. How this can be achieved with Mobile Center, which is not part of any of those solutions?


Mobile Center has a REST API, which can be used to integrate in Azure Pipelines.

However, the REST API scripting in Azure Pipelines is very basic (support only basic authentication, no option to pass parameters between the REST API requests, etc.)

The most elegant solution in this case can be use of Python program or bash script.

Here is the flow:

1. In the example below, the pipeline generates and export the artefact for iOS app in IPA format.  Please be sure to use correct signing method for the IPA. The export task example:

- task: PublishBuildArtifacts@1 inputs: pathToPublish: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)/myApp.ipa' artifactName: 'myApp'


2. Create a task that will install pre-requisite for Python ('requests' module)

- task: Bash@3 inputs: targetType: 'inline' script: python -m pip install --upgrade pip requests
3. Add Python script to your code repository (save, for instance, to root directory as '')
import sys,json, requests PROTOCOL = 'http' PORT = '8080' SERVER = sys.argv[1] USER = sys.argv[2] PASS = sys.argv[3] FILE = sys.argv[4] BASE_URL = PROTOCOL '://' SERVER ':' PORT '/rest' s = requests.Session() # LOGIN url = BASE_URL '/client/login' headers = {'Accept': 'application/json' , 'Content-Type': 'application/json; charset=UTF-8'} payload = {'name': USER , 'password': PASS , 'accountName': 'default'} response =, headers=headers, data=json.dumps(payload)) print ("Connect: ", response.status_code) hp4msecret = response.headers['x-hp4msecret'] jsession = s.cookies['JSESSIONID'] if response.status_code == # UPLOAD APP url = BASE_URL '/apps' file = {'fileUpload': open(FILE, 'rb')} headers = {'x-hp4msecret': hp4msecret, 'JSESSIONID': jsession} response =, headers=headers, files=file) print ("Upload: ", response.status_code) if response.status_code == print ("App Name:", response.json()["name"]) print ("App Id:", response.json()["id"]) print ("App version:", response.json()["version"]) #print ("App Count:", response.json()["count"])
4. Add Python script task that will use the generated IPA/APK file and upload to Mobile Center:

- task: PythonScript@0 inputs: scriptSource: 'filePath' scriptPath: '' arguments: ' $(agent.buildDirectory)/output/$(sdk)/$(configuration)/myApp.ipa'


Run the pipeline - the IPA should be generated and uploaded to Mobile Center.



How To-Best Practice
Comment List