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() DeviceUpdateAccountResource account = await accountCollection.GetAsync("myAccount"); // With DeleteAsync(), we can delete the account await account.DeleteAsync(WaitUntil.Completed); #endregion Snippet:Managing_Accounts_DeleteAnAccount }
public async Task Delete() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string accountName = Recording.GenerateAssetName("Account-"); DeviceUpdateAccountResource account = await CreateAccount(rg, accountName); await account.DeleteAsync(WaitUntil.Completed); var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await account.GetAsync()); Assert.AreEqual(404, ex.Status); }