public IResourceGroup GetAzureResourceGroup(AzureAdOptions azureAdOptions, string resourceGroupName) { IAzure azure = _azureSdkService.GetAzureSdk(azureAdOptions); IResourceGroup resourceGroup = null; if (azure.ResourceGroups.Contain(resourceGroupName)) { resourceGroup = azure.ResourceGroups.GetByName(resourceGroupName); } return(resourceGroup); }
public void CreateResourceGroupTag(AzureAdOptions azureAdOptions, string resourceGroupName, string tagKey, string tagValue) { IAzure azure = _azureSdkService.GetAzureSdk(azureAdOptions); if (azure.ResourceGroups.Contain(resourceGroupName)) { var resourceGroup = azure.ResourceGroups.GetByName(resourceGroupName); resourceGroup.Update() .WithTag(tagKey, tagValue) .Apply(); } else { throw new ApplicationException($"ERROR: Create ResourceGroupTag: Unable to find resource group called '{resourceGroupName}'."); } }
public void CreateAzureResourceGroup(AzureAdOptions azureAdOptions, string resourceGroupName, string regionName, Dictionary <string, string> tags = null) { IAzure azure = _azureSdkService.GetAzureSdk(azureAdOptions); if (!azure.ResourceGroups.Contain(resourceGroupName)) { var region = AzureRegionService.GetRegion(regionName); if (region == null) { throw new ApplicationException($"{regionName}"); } var resourceGroup = azure.ResourceGroups .Define(resourceGroupName) .WithRegion(region) .WithTags(tags) .Create(); } }
public IAzure GetAzureSdk(AzureAdOptions azureAdOptions) { return(GetAzureSdk(azureAdOptions.ClientId, azureAdOptions.ClientSecret, azureAdOptions.TenantId, azureAdOptions.SubscriptionId)); }
public IAuthenticated GetAuthenticatedSdk(AzureAdOptions azureAdOptions) { return(GetAuthenticatedSdk(azureAdOptions.ClientId, azureAdOptions.ClientSecret, azureAdOptions.TenantId, azureAdOptions.SubscriptionId)); }