/// <summary>
        /// Insert credentials into the hub description for this app
        /// </summary>
        /// <param name="hubDescription">Hub description for this app</param>
        protected override void CreateCredentialForHubDescription(NotificationHubDescription hubDescription)
        {
            // check inputs
            if (string.IsNullOrWhiteSpace(this.apiKey))
            {
                this.Log.LogException("got empty apiKey");
            }

            GcmCredential gcmCredential = new GcmCredential(this.apiKey);

            hubDescription.GcmCredential = gcmCredential;
        }
        static async Task Main(string[] args)
        {
            var clientId = "1950a258-227b-4e31-a9cf-717495945fc2"; // "well-known" value: https://blogs.technet.microsoft.com/keithmayer/2014/12/30/leveraging-the-azure-service-management-rest-api-with-azure-active-directory-and-powershell-list-azure-administrators/
            var config   = LoadConfiguration(args);
            //var authorizationRule = "DefaultFullSharedAccessSignature";

            var creds = await UserTokenProvider.LoginByDeviceCodeAsync(clientId, (deviceCodeResult) =>
            {
                Console.WriteLine(deviceCodeResult.Message);
                return(true);
            });

            // Create resource group
            var resourceClient = new ResourceManagementClient(creds)
            {
                SubscriptionId = config.SubscriptionId
            };
            await resourceClient.ResourceGroups.CreateOrUpdateAsync(config.ResourceGroupName, new ResourceGroup(config.Location));

            var nhManagementClient = new NotificationHubsManagementClient(creds)
            {
                SubscriptionId = config.SubscriptionId
            };

            // Create namespace
            await nhManagementClient.Namespaces.CreateOrUpdateAsync(config.ResourceGroupName, config.NamespaceName, new NamespaceCreateOrUpdateParameters(config.Location)
            {
                Sku = new Microsoft.Azure.Management.NotificationHubs.Models.Sku("standard")
            });

            // Create hub
            GcmCredential  gcmCreds  = null;
            ApnsCredential apnsCreds = null;

            if (config.GcmCreds != null)
            {
                gcmCreds = new GcmCredential
                {
                    GoogleApiKey = config.GcmCreds
                };
            }
            if (config.ApnsCreds != null)
            {
                var apnsCredsSplit = config.ApnsCreds.Replace("\\n", "\n").Split(";");
                apnsCreds = new ApnsCredential
                {
                    KeyId = apnsCredsSplit[0],
                    // Id
                    AppName = apnsCredsSplit[1],
                    // Prefix
                    AppId    = apnsCredsSplit[2],
                    Token    = apnsCredsSplit[3],
                    Endpoint = "https://api.development.push.apple.com:443/3/device"
                };
            }
            await nhManagementClient.NotificationHubs.CreateOrUpdateAsync(config.ResourceGroupName, config.NamespaceName, config.HubName, new NotificationHubCreateOrUpdateParameters(config.Location)
            {
                GcmCredential  = gcmCreds,
                ApnsCredential = apnsCreds
            });

            Console.WriteLine($"Create NotificationHub {config.HubName}.");
        }