public async Task DeleteRg()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);

            var rgOp = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, Recording.GenerateAssetName("testrg"), new ResourceGroupData(AzureLocation.WestUS2));

            ResourceGroupResource rg = rgOp.Value;
            await rg.DeleteAsync(WaitUntil.Completed);
        }
        public async Task DeleteResourceGroup()
        {
            #region Snippet:Managing_Resource_Groups_DeleteResourceGroup
            ArmClient            client       = new ArmClient(new DefaultAzureCredential());
            SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();

            ResourceGroupCollection resourceGroups = subscription.GetResourceGroups();
            string resourceGroupName            = "myRgName";
            ResourceGroupResource resourceGroup = await resourceGroups.GetAsync(resourceGroupName);

            await resourceGroup.DeleteAsync(WaitUntil.Completed);

            #endregion Snippet:Managing_Resource_Groups_DeleteResourceGroup
        }
        public async Task StartDeleteRg()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);

            var rgOp = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, Recording.GenerateAssetName("testrg"), new ResourceGroupData(AzureLocation.WestUS2));

            ResourceGroupResource rg = rgOp.Value;
            var deleteOp             = await rg.DeleteAsync(WaitUntil.Started);

            var response = deleteOp.GetRawResponse();

            Assert.AreEqual(202, response.Status);
            await deleteOp.UpdateStatusAsync();

            await deleteOp.WaitForCompletionResponseAsync();

            await deleteOp.WaitForCompletionResponseAsync(TimeSpan.FromSeconds(2));
        }
 public async Task GlobleTearDown()
 {
     await _resourceGroup.DeleteAsync(WaitUntil.Completed);
 }