How to use automatic provisioning for iOS builds in Azure Pipeline


I am trying to use the automatic provisioning for iOS builds. On my Mac it works correctly, but when I tried to do it on Azure pipeline I get the following error

error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'XXX' from project 'XXXX')
error: No profiles for 'com.devhaus.ljdev' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.XXXX'. (in target 'XXXX' from project 'XXXX')

In my yaml I only have the InstallAppleCertificate task which runs successfully

          - task: InstallAppleCertificate@2
              certSecureFile: $(p12File)
              certPwd: $(p12Password)

          - script: |
              npx run ionic build 
            displayName: "build"

          - script: |
              npx ionic cordova platform add ios@6
            displayName: "build for Apple"

# Didn't just do npx ionic cordova build ios here as there 
# is a bug that will cause the build to hang.

          - script: |
              npx cordova build ios --device
            displayName: "build for IOS"


It is mentioned in this thread that automatic signing only works for development builds. you cannot use auto signing in a DevOps pipeline for distribution(ad hoc, app store, etc).

However, you can always manually sign your ios by specifying the codeSignIdentity and provisioningProfile parameters to build command. For below example command. See cordova document Signing an App

 npx cordova build ios --device --codeSignIdentity="$(APPLE_CERTIFICATE_SIGNING_IDENTITY)" --provisioningProfile="$(APPLE_PROV_PROFILE_UUID)"

When you use Install Apple Certificate and Install Apple Provisioning Profile tasks to download the certificate and provisioning profile in azure devops pipeline. Variables $(APPLE_CERTIFICATE_SIGNING_IDENTITY) and $(APPLE_PROV_PROFILE_UUID) are automatically set by these tasks, which allows you to refer to the Signing identity and Provisioning profile UUID directly. See Microsoft document here.

In the Signing identity field, enter $(APPLE_CERTIFICATE_SIGNING_IDENTITY). This variable is automatically set by the Install Apple Certificate task for the certificate you selected.

In the Provisioning profile UUID field, enter $(APPLE_PROV_PROFILE_UUID). This variable is automatically set by the Install Apple Provisioning Profile task for the provisioning profile you selected.

Answered By – Levi Lu-MSFT

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published