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(), }); }
private async Task <SecretClient> CreateSecretClient(AzureKeyVaultParameters parameters) { var creds = await _tokenCredentialProvider.GetCredentialAsync(); return(new SecretClient(new Uri($"https://{parameters.Name}.vault.azure.net/"), creds)); }
private async Task <SecretClient> CreateSecretClient() { var creds = await _tokenCredentialProvider.GetCredentialAsync(); return(new SecretClient(new Uri($"https://{_vaultName}.vault.azure.net/"), creds)); }