private async void Office365Login()
        {
            // Get the list of subscriptions for the current user
            _office365AccessToken = await AzureManagementUtility.GetAccessTokenAsync(
                AzureManagementUtility.AzureManagementApiURI,
                ConfigurationManager.AppSettings["O365:ClientId"]);

            try
            {
                var office365Account = await AzureManagementUtility.GetUserUniqueId(ConfigurationManager.AppSettings["O365:ClientId"]);

                Regex regex = new Regex(@"(?<mailbox>.*)@(?<tenant>\w*)\.(?<remainder>.*)");
                var   match = regex.Match(office365Account);
                _tenantName = match.Groups["tenant"].Value;
                var remainderName = match.Groups["remainder"].Value;

                // Configure parameters based on the current Office 365 tenant name
                this.ApplicationUniqueUri = $"https://{_tenantName}.{remainderName}/PnP-Partner-Pack";
                // this.AzureWebAppUrl = $"https://pnp-partner-pack-{_tenantName}.azurewebsites.net/";
                this.AbsoluteUrl          = $"https://{_tenantName}.sharepoint.com/sites/PnP-Partner-Pack";
                this.PrimaryAdmin         = office365Account;
                this.AzureAppServiceName  = $"pnp-partner-pack-{_tenantName}";
                this.AzureBlobStorageName = $"{_tenantName}storage";
            }
            catch
            {
                // Intentionally ignore any exception related to settings suggestion, because they are not really critical
            }

            if (!String.IsNullOrEmpty(_office365AccessToken))
            {
                var subscriptions = (await AzureManagementUtility.ListSubscriptionsAsync(_office365AccessToken)).ToArray();
                if (subscriptions.Length == 0)
                {
                    throw new ApplicationException("Missing default Azure subscription for Office 365 tenant!");
                }
                else
                {
                    Office365AzureSubscription = subscriptions[0].Key;
                }
            }
        }
        private async void AzureLogin()
        {
            // Start the ring rotation
            _azureLoggedIn     = true;
            AzureSubscriptions = null;
            OnPropertyChanged(nameof(AzureSubscriptionsReady));
            OnPropertyChanged(nameof(AzureSubscriptionsNotReady));

            // Get the list of subscriptions for the current user
            //AzureSubscriptions = Enumerable.Range(1, 10).Select(n => new KeyValuePair<Guid, string>(Guid.NewGuid(), "Subscription " + n)).ToArray();
            _azureAccessToken = await AzureManagementUtility.GetAccessTokenAsync(
                AzureManagementUtility.AzureManagementApiURI);

            if (!String.IsNullOrEmpty(_azureAccessToken))
            {
                AzureSubscriptions = (await AzureManagementUtility.ListSubscriptionsAsync(_azureAccessToken)).ToArray();
                AzureSubscription  = AzureSubscriptions[0];

                AzureLocations = (await AzureManagementUtility.ListLocations(_azureAccessToken, AzureSubscription.Value.Key)).ToArray();
                AzureLocation  = AzureLocations[0];
            }
        }