Visual Studio for Windows Authentication service is unavailable

Mark Ross-Naylor 1 Reputation point
2021-05-05T01:07:03.577+00:00

Up until a month ago, I was able to build my iOS mobile app, and create an ipa file for distribution to my iPhone. However, since then, my role appears to have changed in the Tools > Xamarin > Apple Accounts from agent to XCODE_FREE_USER. This is the only thing that I spotted that had changed. Apart from the fact that it had been exactly one year since I joined the Apple Developer program.

Currently any attempt to change to either Automatic or Manual Provisioning in the iOS Bundle Signing, or to re-download the current profile for my development and distribution certificates in the Tools > Xamarin > Apple Accounts ends with “Authentication service is unavailable”.

Over the last month, I’ve literally tried everything short of a complete Visual Studio uninstall and reinstall. So far I have tried the following:

  • deleted the local XMA folder and restarted vs
  • upgraded vs 2019 to the latest version 16.9.3
  • upgraded my Mac OS to Catalina 10.15.4
  • deleted my dev and dist certificates and profile in my Apple Dev portal and re-added them
  • removed and re-added many times my Apple ID in Tools > Xamarin > Apple Accounts and even reset my password
  • manually deleted the certificates and profiles from local iOS cache before attempted reload

I am at my wits end. Can someone please help? Surely there should be a simple fail proof procedure to reset and synchronise the security settings on both my Mac and Visual Studio for windows. Cheers.

Developer technologies .NET Xamarin
{count} votes

2 answers

Sort by: Most helpful
  1. Mark Ross-Naylor 1 Reputation point
    2021-05-05T09:28:12.88+00:00

    Thank you for your reply. I have previously seen the stackoverflow article and tried some of these suggestions, but I’ll retry them all and see how I go. Only one question about the Xcode steps in the other link. Is this referring to Xcode on my Mac or my PC? Or both? As mentioned, I have Visual Studio for Windows on my PC and a Mac networked in for build purposes. Cheers.


  2. Mark Ross-Naylor 1 Reputation point
    2021-05-06T04:53:26.92+00:00

    Hi. Well I surprised myself. I actually got it working again. See steps below!! But I think it was more by luck than through knowledge. The key was waiting for an hour between steps 7 and 8 below, and certainly doing a full rebuild and simulation run before attempting to build the new ipa file. Bizarrely, it would not build an ipa until I did these two processes. Sigh!! Now waiting on a proper Visual Studio bug fix. Cheers, and thanks for your help.

    1. Remove App provisioning
      • Open Visual Studio project on PC
      • Using "Tools > Options > Xamarin > Apple Accounts" remove the Apple ID entry
      • Close Visual Studio
    2. Clean out all certificates and profiles on the Apple Dev Portal
      • revoke any development and Distribution certificates
      • remove any relates profiles (devices and identifiers can be retained)
    3. Clean out all certificates stored in the Mac KeyChain Access
    4. Using Finder and Xcode, ensure all certificates and profiles are removed
      • Restart Mac if powered up while the above is being performed
      • Use Finder "Go > Go to Folder" to open ~/Library
      • open MobileDevice\Provisioning Profiles and delete all files in this location
      • use Xcode "Xcode > Preferences"
      • open the Accounts tab (and signin if required)
      • click on Manage Certificates and ensure none are present
    5. Create 2 new Certificate Signing Requests in the Mac KeyChain Access
      • goto "Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority"
      • enter Email Address and Common Name (leave CA Email blank) and choose Saved to disk then click Continue
      • Change the request name in Save As to AppleDevelopment.certSigningRequest
      • Repeat to create the AppleDistribution.certSigningRequest
    6. Recreate and load the Development and Distribution certificates and profiles on the Apple Dev Portal
      • the developement certificate must use the AppleDevelopment.certSigningRequest created above
      • the distribution certificate must use the AppleDistribution.certSigningRequestcreated above
      • the profile must activiate all devices, use the appropriate identifier and link to the new distribution certificate
      • ???? download the created certificates to the Mac, open with Keychain Access (this will install them) and check they are valid
      • restart the Mac
    7. Reset App provisioning
      • Ensure Visual Studio on PC is closed
      • delete the folder %LOCALAPPDATA%\Temp\Xamarin\XMA
      • delete the certificates in ..\Users\<USER ACCOUNT>\AppData\Local\Xamarin\iOS\Provisioning\Certificates
      • delete the profiles in ..\Users\<USER ACCOUNT>\AppData\Local\Xamarin\iOS\Provisioning\Profiles
      • delete the accounts.pass and Provisioning Profiles.index files in ..\Users\<USER ACCOUNT>\AppData\Local\Xamarin\iOS\Provisioning
      • Open Visual Studio project on PC
      • After initialization and Mac pairing completed, Set (or reset) Bundle Signing in the iOS proect settings to Automatic
        (note: you will need to add the Apple ID account first)
      • Close Visual Studio and Restart PC
      • Re-open Visual Studio project on PC
      • After initialization and Mac pairing completed, Clean the Solution

    WAIT FOR AN HOUR FOR APPLE DEV PORTAL CHANGES TO BECOME AVAILABLE

    1. Reset App provisioning again
      • Open Visual Studio project on PC
      • After initialization and Mac pairing completed, Set (or reset) Bundle Signing in the iOS proect settings to Automatic
        (THIS SHOULD NOW BRING IN THE CERTIFICATES AND PROFILE)
      • rebuild the full solution
      • run the App using a simulator
      • then change to the build device and build the ipa file

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.