Using ARM template, we can define a storage account under a batch account. But how we can do this using .NET SDK? Currently I can create BatchAccount and StorageAccount as separate resources, but what to do if a StorageAccount should be appeared under BatchAccount I.e. under "SETTINGS" TAB of the BatchAccount
Asked
Active
Viewed 43 times
1 Answers
0
Below code works for me.
//Getting StorageAccount to bind
var storageAccount = await storageManagementClient.StorageAccounts.GetPropertiesAsync("testresourcegroup", "teststorageaccount");
//Creating binding properties
AutoStorageBaseProperties baseProperties = new AutoStorageBaseProperties { StorageAccountId = storageAccount.Id };
//Creating update parametrs for Batch Account
BatchAccountUpdateParameters updateParameters = new BatchAccountUpdateParameters { AutoStorage = baseProperties };
//Updatting the BatchAccount to bind with chosen StorageAccount
var response = await batchManagementClient.BatchAccount.UpdateAsync("testresourcegroup", "testbatchaccount", updateParameters);

Jaish Mathews
- 766
- 1
- 9
- 25