Azure credentials
Freeleapp relies on the Azure CLI (2.30.0 or later), which stores tokens in ~/.azure/msal_token_cache.json and profiles in ~/.azure/azureProfile.json. Freeleapp keeps the long-lived part of those tokens in the keychain and leaves only short-lived ones in the Azure CLI files.
Logging in to an integration
Section titled “Logging in to an integration”- Clean
msal_token_cache.jsonandazureProfile.json. - Run
az login --tenant <tenant-id>to get the user profile and a refresh token for the integration. - Create a session for each subscription in the tenant.
- Save the refresh token, account and profile in the system vault.
- Remove that information from the Azure CLI files.
Starting a session
Section titled “Starting a session”Only one Azure session can be active at a time.
- Read the refresh token, account and profile from the vault.
- Write the profile of the chosen subscription to
azureProfile.json, and the account and refresh token tomsal_token_cache.json. - Run
az account get-access-token --subscription <subscription-id>to get the access and ID tokens, which the CLI writes to its cache. - Save the updated refresh token in the vault and remove it from
msal_token_cache.json.
A refresh token can last up to 90 days; an access token lasts about 70 minutes.
Rotating and stopping
Section titled “Rotating and stopping”Every 20 minutes Freeleapp checks whether the access token expires soon. If it does, it puts the refresh token back in the cache, requests new tokens and removes the refresh token again.
Stopping the session runs az logout, which clears both Azure CLI files.