public async Task DeleteAccounts() { #region Snippet:Managing_Accounts_DeleteAnAccount // First we need to get the account collection from the specific resource group DeviceUpdateAccountCollection accountCollection = resourceGroup.GetDeviceUpdateAccounts(); // Now we can get the account with GetAsync() DeviceUpdateAccount account = await accountCollection.GetAsync("myAccount"); // With DeleteAsync(), we can delete the account await account.DeleteAsync(true); #endregion Snippet:Managing_Accounts_DeleteAnAccount }
public async Task UpdateAccounts() { #region Snippet:Managing_Accounts_UpdateAnAccount // First we need to get the account collection from the specific resource group DeviceUpdateAccountCollection accountCollection = resourceGroup.GetDeviceUpdateAccounts(); // Now we can get the account with GetAsync() DeviceUpdateAccount account = await accountCollection.GetAsync("myAccount"); // With UpdateAsync(), we can update the account DeviceUpdateAccountUpdateOptions updateOptions = new DeviceUpdateAccountUpdateOptions() { Location = AzureLocation.WestUS2, Identity = new ManagedServiceIdentity(ResourceManager.Models.ManagedServiceIdentityType.None) }; ArmOperation <DeviceUpdateAccount> lro = await account.UpdateAsync(true, updateOptions); account = lro.Value; #endregion Snippet:Managing_Accounts_UpdateAnAccount }
public async Task ListAccounts() { #region Snippet:Managing_Accounts_ListAllAccounts // First we need to get the account collection from the specific resource group DeviceUpdateAccountCollection accountCollection = resourceGroup.GetDeviceUpdateAccounts(); // With GetAllAsync(), we can get a list of the accounts in the collection AsyncPageable <DeviceUpdateAccount> response = accountCollection.GetAllAsync(); await foreach (DeviceUpdateAccount account in response) { Console.WriteLine(account.Data.Name); } //We can also list all accounts in the subscription response = subscription.GetDeviceUpdateAccountsAsync(); await foreach (DeviceUpdateAccount account in response) { Console.WriteLine(account.Data.Name); } #endregion Snippet:Managing_Accounts_ListAllAccounts }