/// <summary> /// Creates a new Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group in which to create the account</param> /// <param name="accountName">The account name</param> /// <param name="location">The location to use when creating the account</param> /// <param name="tags">The tags to associate with the account</param> /// <param name="autoStorageAccountId">The resource id of the storage account to be used for auto storage.</param> /// <returns>A BatchAccountContext object representing the new account</returns> public virtual BatchAccountContext CreateAccount(string resourceGroupName, string accountName, string location, Hashtable[] tags, string autoStorageAccountId) { // use the group lookup to validate whether account already exists. We don't care about the returned // group name nor the exception if (GetGroupForAccountNoThrow(accountName) != null) { throw new CloudException(Resources.AccountAlreadyExists); } Dictionary <string, string> tagDictionary = Helpers.CreateTagDictionary(tags, validate: true); AutoStorageBaseProperties autoStorage = (string.IsNullOrEmpty(autoStorageAccountId)) ? null : new AutoStorageBaseProperties { StorageAccountId = autoStorageAccountId }; var response = BatchManagementClient.Account.Create(resourceGroupName, accountName, new BatchAccountCreateParameters() { Location = location, Tags = tagDictionary, AutoStorage = autoStorage }); var context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(response); return(context); }
public void ListBatchAccountsTest() { List <BatchAccountContext> pipelineOutput = new List <BatchAccountContext>(); string accountName01 = "account01"; string resourceGroup = "resourceGroup"; AccountResource accountResource01 = BatchTestHelpers.CreateAccountResource(accountName01, resourceGroup); string accountName02 = "account02"; AccountResource accountResource02 = BatchTestHelpers.CreateAccountResource(accountName02, resourceGroup); BatchAccountContext expected01 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource01); BatchAccountContext expected02 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource02); batchClientMock.Setup(b => b.ListAccounts(resourceGroup, null)).Returns(new List <BatchAccountContext>() { expected01, expected02 }); cmdlet.AccountName = null; cmdlet.ResourceGroupName = resourceGroup; cmdlet.Tag = null; cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected01), Times.Once()); commandRuntimeMock.Verify(r => r.WriteObject(expected02), Times.Once()); }
public void BatchAccountContextFromResourceTest() { string account = "account"; string tenantUrlEnding = "batch-test.windows-int.net"; string endpoint = string.Format("{0}.{1}", account, tenantUrlEnding); string subscription = "00000000-0000-0000-0000-000000000000"; string resourceGroup = "resourceGroup"; string id = string.Format("id/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Batch/batchAccounts/abc", subscription, resourceGroup); AccountResource resource = new AccountResource( coreQuota: BatchTestHelpers.DefaultQuotaCount, poolQuota: BatchTestHelpers.DefaultQuotaCount, activeJobAndJobScheduleQuota: BatchTestHelpers.DefaultQuotaCount, id: id, type: "type") { Location = "location", AccountEndpoint = endpoint, ProvisioningState = AccountProvisioningState.Succeeded, }; BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource); Assert.Equal <string>(context.Id, resource.Id); Assert.Equal <string>(context.AccountEndpoint, resource.AccountEndpoint); Assert.Equal <string>(context.Location, resource.Location); Assert.Equal <string>(context.State, resource.ProvisioningState.ToString()); Assert.Equal <string>(context.AccountName, account); Assert.Equal <string>(context.TaskTenantUrl, string.Format("https://{0}", endpoint)); Assert.Equal <string>(context.Subscription, subscription); Assert.Equal <string>(context.ResourceGroupName, resourceGroup); }
public void NewBatchWithAutoStorageAccountTest() { string accountName = "account01"; string resourceGroup = "resourceGroup"; string location = "location"; string storageId = "storageId"; AccountCreateParameters actualCreateParameters = null; // Setup the mock client to return a fake response and capture the account create parameters BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup, location); BatchAccountContext fakeResponse = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null); batchClientMock.Setup(b => b.CreateAccount(It.IsAny <AccountCreateParameters>())) .Returns(fakeResponse) .Callback((AccountCreateParameters p) => actualCreateParameters = p); // Setup and run the cmdlet cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.Location = location; cmdlet.AutoStorageAccountId = storageId; cmdlet.ExecuteCmdlet(); // Verify the fake response was written to the pipeline and that the captured account create // parameters matched expectations. commandRuntimeMock.Verify(r => r.WriteObject(fakeResponse), Times.Once()); Assert.Equal(accountName, actualCreateParameters.BatchAccount); Assert.Equal(resourceGroup, actualCreateParameters.ResourceGroup); Assert.Equal(location, actualCreateParameters.Location); Assert.Equal(storageId, actualCreateParameters.AutoStorageAccountId); }
public void BatchAccountContextFromResourceTest() { string account = "account"; string tenantUrlEnding = "batch-test.windows-int.net"; string endpoint = string.Format("{0}.{1}", account, tenantUrlEnding); string subscription = "00000000-0000-0000-0000-000000000000"; string resourceGroup = "resourceGroup"; AccountResource resource = new AccountResource() { Id = string.Format("id/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Batch/batchAccounts/abc", subscription, resourceGroup), Location = "location", Properties = new AccountProperties() { AccountEndpoint = endpoint, ProvisioningState = AccountProvisioningState.Succeeded }, Type = "type" }; BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource); Assert.Equal <string>(context.Id, resource.Id); Assert.Equal <string>(context.AccountEndpoint, resource.Properties.AccountEndpoint); Assert.Equal <string>(context.Location, resource.Location); Assert.Equal <string>(context.State, resource.Properties.ProvisioningState.ToString()); Assert.Equal <string>(context.AccountName, account); Assert.Equal <string>(context.TaskTenantUrl, string.Format("https://{0}", endpoint)); Assert.Equal <string>(context.Subscription, subscription); Assert.Equal <string>(context.ResourceGroupName, resourceGroup); }
public void UpdateAccountTest() { string accountName = "account01"; string resourceGroup = "resourceGroup"; Hashtable[] tags = new[] { new Hashtable { { "Name", "tagName" }, { "Value", "tagValue" } } }; AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup, tags); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource); batchClientMock.Setup(b => b.UpdateAccount(resourceGroup, accountName, tags)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.Tag = tags; cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
/// <summary> /// Creates a new Batch account /// </summary> /// <param name="parameters">The parameters defining the Batch account to create.</param> /// <returns>A BatchAccountContext object representing the new account</returns> public virtual BatchAccountContext CreateAccount(AccountCreateParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } Dictionary <string, string> tagDictionary = TagsConversionHelper.CreateTagDictionary(parameters.Tags, validate: true); AutoStorageBaseProperties autoStorage = (string.IsNullOrEmpty(parameters.AutoStorageAccountId)) ? null : new AutoStorageBaseProperties { StorageAccountId = parameters.AutoStorageAccountId }; KeyVaultReference keyVaultRef = null; if (!string.IsNullOrEmpty(parameters.KeyVaultId) || !string.IsNullOrEmpty(parameters.KeyVaultUrl)) { keyVaultRef = new KeyVaultReference(parameters.KeyVaultId, parameters.KeyVaultUrl); } var response = BatchManagementClient.BatchAccount.Create(parameters.ResourceGroup, parameters.BatchAccount, new BatchAccountCreateParameters() { Location = parameters.Location, Tags = tagDictionary, AutoStorage = autoStorage, PoolAllocationMode = parameters.PoolAllocationMode, KeyVaultReference = keyVaultRef, PublicNetworkAccess = parameters.PublicNetworkAccess }); var context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(response, this.azureContext); return(context); }
/// <summary> /// Updates an existing Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group the account is under. If unspecified, it will be looked up.</param> /// <param name="accountName">The account name</param> /// <param name="tags">New tags to associate with the account</param> /// <param name="autoStorageAccountId">The resource id of the storage account to be used for auto storage.</param> /// <returns>A BatchAccountContext object representing the updated account</returns> public virtual BatchAccountContext UpdateAccount(string resourceGroupName, string accountName, Hashtable tags, string autoStorageAccountId) { if (string.IsNullOrEmpty(resourceGroupName)) { // use resource mgr to see if account exists and then use resource group name to do the actual lookup resourceGroupName = GetGroupForAccount(accountName); } Dictionary <string, string> tagDictionary = TagsConversionHelper.CreateTagDictionary(tags, validate: true); // need to the location in order to call var getResponse = BatchManagementClient.BatchAccount.Get(resourceGroupName, accountName); AutoStorageBaseProperties autoStorage = (autoStorageAccountId == null) ? null : new AutoStorageBaseProperties { StorageAccountId = autoStorageAccountId }; var response = BatchManagementClient.BatchAccount.Create(resourceGroupName, accountName, new BatchAccountCreateParameters() { Location = getResponse.Location, Tags = tagDictionary, AutoStorage = autoStorage }); BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(response, this.azureContext); return(context); }
/// <summary> /// Builds a BatchAccountContext object with the keys set for testing /// </summary> public static BatchAccountContext CreateBatchContextWithKeys() { AccountResource resource = CreateAccountResource("account", "resourceGroup"); BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource); string dummyKey = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; SetProperty(context, "PrimaryAccountKey", dummyKey); SetProperty(context, "SecondaryAccountKey", dummyKey); return(context); }
/// <summary> /// Get details about the Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group the account is under. If unspecified, it will be looked up.</param> /// <param name="accountName">The account name</param> /// <returns>A BatchAccountContext object representing the account</returns> public virtual BatchAccountContext GetAccount(string resourceGroupName, string accountName) { // single account lookup - find its resource group if not specified if (string.IsNullOrEmpty(resourceGroupName)) { resourceGroupName = GetGroupForAccount(accountName); } var response = BatchManagementClient.BatchAccount.Get(resourceGroupName, accountName); return(BatchAccountContext.ConvertAccountResourceToNewAccountContext(response, this.azureContext)); }
/// <summary> /// Lists all accounts in a subscription or in a resource group if its name is specified /// </summary> /// <param name="resourceGroupName">The name of the resource group to search under for accounts. If unspecified, all accounts will be looked up.</param> /// <param name="tag">The tag to filter accounts on</param> /// <returns>A collection of BatchAccountContext objects</returns> public virtual IEnumerable <BatchAccountContext> ListAccounts(Hashtable tag, string resourceGroupName = default(string)) { // no account name so we're doing some sort of list. If no resource group, then list all accounts under the // subscription otherwise all accounts in the resource group. var response = string.IsNullOrEmpty(resourceGroupName) ? BatchManagementClient.BatchAccount.List() : BatchManagementClient.BatchAccount.ListByResourceGroup(resourceGroupName); var batchAccountContexts = ListAllAccounts(response). Where(acct => Helpers.MatchesTag(acct, tag)). Select(resource => BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource, this.azureContext)); return(batchAccountContexts); }
public void GetBatchAccount_IdentityTest() { string accountName = "account01"; string resourceGroup = "resourceGroup"; BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup, identity: new BatchAccountIdentity(ResourceIdentityType.None, string.Empty, string.Empty, null as IDictionary <string, UserAssignedIdentities>)); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null); batchClientMock.Setup(b => b.GetAccount(resourceGroup, accountName)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
public void GetBatchAccountTest() { string accountName = "account01"; string resourceGroup = "resourceGroup"; AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource); batchClientMock.Setup(b => b.GetAccount(resourceGroup, accountName)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
/// <summary> /// Creates an account and resource group for use with the Scenario tests /// </summary> public static BatchAccountContext CreateTestAccountAndResourceGroup(BatchController controller, string resourceGroupName, string accountName, string location) { controller.ResourceManagementClient.ResourceGroups.CreateOrUpdate(resourceGroupName, new ResourceGroup() { Location = location }); BatchAccount createResponse = controller.BatchManagementClient.BatchAccount.Create(resourceGroupName, accountName, new BatchAccountCreateParameters() { Location = location }); BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(createResponse); BatchAccountKeys response = controller.BatchManagementClient.BatchAccount.GetKeys(resourceGroupName, accountName); context.PrimaryAccountKey = response.Primary; context.SecondaryAccountKey = response.Secondary; return(context); }
/// <summary> /// Lists all accounts in a subscription or in a resource group if its name is specified /// </summary> /// <param name="resourceGroupName">The name of the resource group to search under for accounts. If unspecified, all accounts will be looked up.</param> /// <param name="tag">The tag to filter accounts on</param> /// <returns>A collection of BatchAccountContext objects</returns> public virtual IEnumerable <BatchAccountContext> ListAccounts(string resourceGroupName, Hashtable tag) { List <BatchAccountContext> accounts = new List <BatchAccountContext>(); // no account name so we're doing some sort of list. If no resource group, then list all accounts under the // subscription otherwise all accounts in the resource group. var response = BatchManagementClient.Accounts.List(new AccountListParameters { ResourceGroupName = resourceGroupName }); // filter out the accounts if a tag was specified IList <AccountResource> accountResources = new List <AccountResource>(); if (tag != null && tag.Count > 0) { accountResources = Helpers.FilterAccounts(response.Accounts, tag); } else { accountResources = response.Accounts; } foreach (AccountResource resource in accountResources) { accounts.Add(BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource)); } var nextLink = response.NextLink; while (nextLink != null) { response = ListNextAccounts(nextLink); foreach (AccountResource resource in response.Accounts) { accounts.Add(BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource)); } nextLink = response.NextLink; } return(accounts); }
/// <summary> /// Creates a new Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group in which to create the account</param> /// <param name="accountName">The account name</param> /// <param name="location">The location to use when creating the account</param> /// <param name="tags">The tags to associate with the account</param> /// <param name="autoStorageAccountId">The resource id of the storage account to be used for auto storage.</param> /// <returns>A BatchAccountContext object representing the new account</returns> public virtual BatchAccountContext CreateAccount(string resourceGroupName, string accountName, string location, Hashtable tags, string autoStorageAccountId) { Dictionary <string, string> tagDictionary = TagsConversionHelper.CreateTagDictionary(tags, validate: true); AutoStorageBaseProperties autoStorage = (string.IsNullOrEmpty(autoStorageAccountId)) ? null : new AutoStorageBaseProperties { StorageAccountId = autoStorageAccountId }; var response = BatchManagementClient.BatchAccount.Create(resourceGroupName, accountName, new BatchAccountCreateParameters() { Location = location, Tags = tagDictionary, AutoStorage = autoStorage }); var context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(response); return(context); }
public void NewBatchWithAutoStorageAccountTest() { string accountName = "account01"; string resourceGroup = "resourceGroup"; string location = "location"; string storageId = "storageId"; BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource); batchClientMock.Setup(b => b.CreateAccount(resourceGroup, accountName, location, null, storageId)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.Location = location; cmdlet.AutoStorageAccountId = storageId; cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
public void BatchAccountContextFromResourceTest() { string account = "account"; string tenantUrlEnding = "batch-test.windows-int.net"; string endpoint = string.Format("{0}.{1}", account, tenantUrlEnding); string subscription = "00000000-0000-0000-0000-000000000000"; string resourceGroup = "resourceGroup"; string id = string.Format("id/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Batch/batchAccounts/abc", subscription, resourceGroup); PoolAllocationMode allocationMode = PoolAllocationMode.UserSubscription; KeyVaultReference keyVault = new KeyVaultReference( string.Format("/subscriptions{0}/resourceGroups/{1}/providers/Microsoft.KeyVault/vaults/foo", subscription, resourceGroup), "https://foo.vaults.azure.com"); BatchAccount resource = new BatchAccount( dedicatedCoreQuota: BatchTestHelpers.DefaultQuotaCount, lowPriorityCoreQuota: BatchTestHelpers.DefaultQuotaCount, poolQuota: BatchTestHelpers.DefaultQuotaCount, activeJobAndJobScheduleQuota: BatchTestHelpers.DefaultQuotaCount, accountEndpoint: endpoint, id: id, type: "type", location: "location", provisioningState: ProvisioningState.Succeeded, poolAllocationMode: allocationMode, keyVaultReference: keyVault); BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(resource, null); Assert.Equal(resource.Id, context.Id); Assert.Equal(resource.AccountEndpoint, context.AccountEndpoint); Assert.Equal(resource.Location, context.Location); Assert.Equal(resource.ProvisioningState.ToString(), context.State); Assert.Equal(account, context.AccountName); Assert.Equal(string.Format("https://{0}", endpoint), context.TaskTenantUrl); Assert.Equal(subscription, context.Subscription); Assert.Equal(resourceGroup, context.ResourceGroupName); Assert.Equal(allocationMode, context.PoolAllocationMode); Assert.Equal(keyVault.Id, context.KeyVaultReference.Id); Assert.Equal(keyVault.Url, context.KeyVaultReference.Url); }
public void RegenBatchAccountKeysTest() { string newPrimaryKey = "newPrimaryKey"; string newSecondaryKey = "newSecondaryKey"; string accountName = "account01"; string resourceGroup = "resourceGroup"; AccountKeyType keyType = AccountKeyType.Primary; AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource); expected.PrimaryAccountKey = newPrimaryKey; expected.SecondaryAccountKey = newSecondaryKey; batchClientMock.Setup(b => b.RegenerateKeys(resourceGroup, accountName, keyType)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.KeyType = keyType.ToString(); cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
public void GetBatchAccountKeysTest() { string primaryKey = "pKey"; string secondaryKey = "sKey"; string accountName = "account01"; string resourceGroup = "resourceGroup"; BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup); BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null); expected.PrimaryAccountKey = primaryKey; expected.SecondaryAccountKey = secondaryKey; batchClientMock.Setup(b => b.GetKeys(resourceGroup, accountName)).Returns(expected); cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.ExecuteCmdlet(); commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once()); }
public void CanCreateUserSubscriptionBatchAccount() { string accountName = "account01"; string resourceGroup = "resourceGroup"; string location = "location"; string keyVaultId = "subscriptions/0000/resourceGroups/resourceGroup/providers/Microsoft.KeyVault/vaults/myVault"; string keyVaultUrl = "https://myVault.vault.azure.com"; PoolAllocationMode allocationMode = PoolAllocationMode.UserSubscription; AccountCreateParameters actualCreateParameters = null; // Setup the mock client to return a fake response and capture the account create parameters BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup, location); BatchAccountContext fakeResponse = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null); batchClientMock.Setup(b => b.CreateAccount(It.IsAny <AccountCreateParameters>())) .Returns(fakeResponse) .Callback((AccountCreateParameters p) => actualCreateParameters = p); // Setup and run the cmdlet cmdlet.AccountName = accountName; cmdlet.ResourceGroupName = resourceGroup; cmdlet.Location = location; cmdlet.PoolAllocationMode = allocationMode; cmdlet.KeyVaultId = keyVaultId; cmdlet.KeyVaultUrl = keyVaultUrl; cmdlet.ExecuteCmdlet(); // Verify the fake response was written to the pipeline and that the captured account create // parameters matched expectations. commandRuntimeMock.Verify(r => r.WriteObject(fakeResponse), Times.Once()); Assert.Equal(accountName, actualCreateParameters.BatchAccount); Assert.Equal(resourceGroup, actualCreateParameters.ResourceGroup); Assert.Equal(location, actualCreateParameters.Location); Assert.Equal(allocationMode, actualCreateParameters.PoolAllocationMode); Assert.Equal(keyVaultId, actualCreateParameters.KeyVaultId); Assert.Equal(keyVaultUrl, actualCreateParameters.KeyVaultUrl); }
/// <summary> /// Updates an existing Batch account /// </summary> /// <param name="resourceGroupName">The name of the resource group the account is under. If unspecified, it will be looked up.</param> /// <param name="accountName">The account name</param> /// <param name="tags">New tags to associate with the account</param> /// <returns>A BatchAccountContext object representing the updated account</returns> public virtual BatchAccountContext UpdateAccount(string resourceGroupName, string accountName, Hashtable[] tags) { if (string.IsNullOrEmpty(resourceGroupName)) { // use resource mgr to see if account exists and then use resource group name to do the actual lookup resourceGroupName = GetGroupForAccount(accountName); } Dictionary <string, string> tagDictionary = Helpers.CreateTagDictionary(tags, validate: true); // need to the location in order to call var getResponse = BatchManagementClient.Accounts.Get(resourceGroupName, accountName); var response = BatchManagementClient.Accounts.Create(resourceGroupName, accountName, new BatchAccountCreateParameters() { Location = getResponse.Resource.Location, Tags = tagDictionary }); BatchAccountContext context = BatchAccountContext.ConvertAccountResourceToNewAccountContext(response.Resource); return(context); }