/**
* Samples for WebApps Delete.
*/
public final class Main {
/*
* x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteWebApp.json
*/
/**
* Sample code: Delete Web app.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void deleteWebApp(com.azure.resourcemanager.AzureResourceManager azure) {
azure.webApps().manager().serviceClient().getWebApps().deleteWithResponse("testrg123", "sitef6141", null, null,
com.azure.core.util.Context.NONE);
}
}
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.AppService.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.AppService;
// Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteWebApp.json
// this example is just showing the usage of "WebApps_Delete" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://zcusa.951200.xyz/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this WebSiteResource created on azure
// for more information of creating WebSiteResource, please refer to the document of WebSiteResource
string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
string resourceGroupName = "testrg123";
string name = "sitef6141";
ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name);
WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId);
// invoke the operation
await webSite.DeleteAsync(WaitUntil.Completed);
Console.WriteLine("Succeeded");