protected async Task RegisterResourceProvidersAsync(
     CancellationToken cancellationToken = default
     )
 {
     using var resourceMgmtClient = new ResourceMgmtClient(_subscription.SubscriptionId, _restClient);
     await resourceMgmtClient.RegisterRequiredResourceProvidersAsync(cancellationToken);
 }
示例#2
0
        public void InitializeResourceManagementClients(
            CancellationToken cancellationToken = default
            )
        {
            // Microsoft Graph
            var microsoftGraphTokenProvider = _authenticationManager
                                              .GenerateDelegatingTokenProvider(
                _authenticationManager.AcquireMicrosoftGraphTokenAsync
                );

            _msGraphServiceClient = new MicrosoftGraphServiceClient(
                _tenantId,
                microsoftGraphTokenProvider,
                cancellationToken
                );

            // Create generic RestClient for services
            _restClient = RestClient
                          .Configure()
                          .WithEnvironment(_azureEnvironment)
                          .WithCredentials(_azureCredentials)
                          //.WithLogLevel(HttpLoggingDelegatingHandler.Level.BodyAndHeaders)
                          .Build();

            var subscriptionId = _subscription.SubscriptionId;

            _resourceMgmtClient                  = new ResourceMgmtClient(subscriptionId, _restClient);
            _keyVaultManagementClient            = new KeyVaultMgmtClient(subscriptionId, _restClient);
            _storageManagementClient             = new StorageMgmtClient(subscriptionId, _restClient);
            _iotHubManagementClient              = new IotHubMgmtClient(subscriptionId, _restClient);
            _cosmosDBManagementClient            = new CosmosDBMgmtClient(subscriptionId, _restClient);
            _serviceBusManagementClient          = new ServiceBusMgmtClient(subscriptionId, _restClient);
            _eventHubManagementClient            = new EventHubMgmtClient(subscriptionId, _restClient);
            _operationalInsightsManagementClient = new OperationalInsightsMgmtClient(subscriptionId, _restClient);
            _applicationInsightsManagementClient = new ApplicationInsightsMgmtClient(subscriptionId, _restClient);
            _webSiteManagementClient             = new WebSiteMgmtClient(subscriptionId, _restClient);
            _networkManagementClient             = new NetworkMgmtClient(subscriptionId, _restClient);
            _authorizationManagementClient       = new AuthorizationMgmtClient(subscriptionId, _restClient);
            _aksManagementClient                 = new AksMgmtClient(subscriptionId, _restClient);
            _signalRManagementClient             = new SignalRMgmtClient(subscriptionId, _restClient);
        }