public async Task createStorageAccountAndGetFileShareContainer() { ArmClient armClient = new ArmClient(new DefaultAzureCredential()); Subscription subscription = armClient.DefaultSubscription; string rgName = "myRgName"; Location location = Location.WestUS2; ResourceGroupCreateOrUpdateOperation operation = await subscription.GetResourceGroups().CreateOrUpdateAsync(rgName, new ResourceGroupData(location)); ResourceGroup resourceGroup = operation.Value; this.resourceGroup = resourceGroup; Sku sku = new Sku(SkuName.StandardGRS); Kind kind = Kind.Storage; string locationStr = "westus2"; StorageAccountCreateParameters parameters = new StorageAccountCreateParameters(sku, kind, locationStr); StorageAccountContainer accountContainer = resourceGroup.GetStorageAccounts(); string accountName = "myAccount"; StorageAccountCreateOperation accountCreateOperation = await accountContainer.CreateOrUpdateAsync(accountName, parameters); storageAccount = await accountCreateOperation.WaitForCompletionAsync(); #region Snippet:Managing_FileShares_GetFileService FileServiceContainer fileServiceContainer = storageAccount.GetFileServices(); FileService fileService = await fileServiceContainer.GetAsync("default"); #endregion this.fileService = fileService; }
public async Task CreateStorageAccountAndGetFileShareContainer() { _resourceGroup = await CreateResourceGroupAsync(); string accountName = await CreateValidAccountNameAsync("teststoragemgmt"); StorageAccountContainer storageAccountContainer = _resourceGroup.GetStorageAccounts(); _storageAccount = (await storageAccountContainer.CreateOrUpdateAsync(accountName, GetDefaultStorageAccountParameters())).Value; _fileServiceContainer = _storageAccount.GetFileServices(); _fileService = await _fileServiceContainer.GetAsync("default"); _fileShareContainer = _fileService.GetFileShares(); }