예제 #1
0
        public override async Task RunAsync(CancellationToken cancellationToken)
        {
            var creds = await _tokenProvider.GetCredentialAsync();

            var token = await creds.GetTokenAsync(new TokenRequestContext(new []
            {
                "https://servicebus.azure.net/.default",
            }), cancellationToken);

            Debug.WriteLine(token.ExpiresOn);
            _console.WriteImportant("Successfully authenticated");
        }
        private async Task <ServiceBusManagementClient> CreateManagementClient(Parameters parameters, CancellationToken cancellationToken)
        {
            var creds = await _tokenCredentialProvider.GetCredentialAsync();

            var token = await creds.GetTokenAsync(new TokenRequestContext(new[]
            {
                "https://management.azure.com/.default",
            }), cancellationToken);

            var serviceClientCredentials = new TokenCredentials(token.Token);

            return(new ServiceBusManagementClient(serviceClientCredentials)
            {
                SubscriptionId = parameters.Subscription.ToString(),
            });
        }
예제 #3
0
        private async Task <SecretClient> CreateSecretClient(AzureKeyVaultParameters parameters)
        {
            var creds = await _tokenCredentialProvider.GetCredentialAsync();

            return(new SecretClient(new Uri($"https://{parameters.Name}.vault.azure.net/"), creds));
        }
예제 #4
0
        private async Task <SecretClient> CreateSecretClient()
        {
            var creds = await _tokenCredentialProvider.GetCredentialAsync();

            return(new SecretClient(new Uri($"https://{_vaultName}.vault.azure.net/"), creds));
        }