Пример #1
0
        public async Task SetSubscriptionContext(AzureSubscription azureSubscription)
        {
            if (BeforeAzureSubscriptionChange != null)
            {
                await BeforeAzureSubscriptionChange?.Invoke(this);
            }

            if (azureSubscription != null)
            {
                if (azureSubscription.Parent != null)
                {
                    if (azureSubscription.Parent != this._AzureTenant)
                    {
                        await SetTenantContext(azureSubscription.Parent);
                    }
                }
            }

            _AzureSubscription = azureSubscription;

            if (_AzureSubscription != null)
            {
                if (_TokenProvider != null)
                {
                    await _TokenProvider.GetToken(_AzureSubscription);
                }

                await _AzureRetriever.SetSubscriptionContext(_AzureSubscription);
            }

            if (AfterAzureSubscriptionChange != null)
            {
                await AfterAzureSubscriptionChange?.Invoke(this);
            }
        }
Пример #2
0
        public async Task SetSubscriptionContext(AzureSubscription azureSubscription)
        {
            if (BeforeAzureSubscriptionChange != null)
            {
                await BeforeAzureSubscriptionChange?.Invoke(this);
            }

            _AzureSubscription = azureSubscription;

            if (_AzureSubscription != null)
            {
                if (_TokenProvider != null)
                {
                    await _TokenProvider.GetToken(_AzureSubscription);
                }

                if (_AzureRetriever == null)
                {
                    _AzureRetriever = new AzureRetriever(this);
                }

                await _AzureRetriever.SetSubscriptionContext(_AzureSubscription);
            }

            if (AfterAzureSubscriptionChange != null)
            {
                await AfterAzureSubscriptionChange?.Invoke(this);
            }
        }