Static Sites - Delete Static Site Custom Domain
Description for Deletes a custom domain.
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}/customDomains/{domainName}?api-version=2025-03-01
URI Parameters
Name
In
Required
Type
Description
domainName
path
True
string
The custom domain to delete.
name
path
True
string
Name of the static site.
resourceGroupName
path
True
string
minLength: 1 maxLength: 90 pattern: ^[-\w\._\(\)]+[^\.]$
Name of the resource group to which the resource belongs.
subscriptionId
path
True
string
Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
api-version
query
True
string
API Version
Responses
Name
Type
Description
200 OK
OK.
202 Accepted
Asynchronous operation in progress.
Other Status Codes
DefaultErrorResponse
App Service error response.
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name
Description
user_impersonation
impersonate your user account
Examples
Delete a custom domain for a static site
Sample request
DELETE https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0/customDomains/custom.domain.net?api-version=2025-03-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.web import WebSiteManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-web
# USAGE
python delete_static_site_custom_domain.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WebSiteManagementClient(
credential=DefaultAzureCredential(),
subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
)
client.static_sites.begin_delete_static_site_custom_domain(
resource_group_name="rg",
name="testStaticSite0",
domain_name="custom.domain.net",
).result()
# x-ms-original-file: specification/web/resource-manager/Microsoft.Web/AppService/stable/2025-03-01/examples/DeleteStaticSiteCustomDomain.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
package armappservice_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9f4cb2884f1948b879ecfb3f410e8cbc8805c213/specification/web/resource-manager/Microsoft.Web/AppService/stable/2025-03-01/examples/DeleteStaticSiteCustomDomain.json
func ExampleStaticSitesClient_BeginDeleteStaticSiteCustomDomain() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armappservice.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewStaticSitesClient().BeginDeleteStaticSiteCustomDomain(ctx, "rg", "testStaticSite0", "custom.domain.net", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
const { WebSiteManagementClient } = require("@azure/arm-appservice");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv/config");
/**
* This sample demonstrates how to Description for Deletes a custom domain.
*
* @summary Description for Deletes a custom domain.
* x-ms-original-file: specification/web/resource-manager/Microsoft.Web/AppService/stable/2025-03-01/examples/DeleteStaticSiteCustomDomain.json
*/
async function deleteACustomDomainForAStaticSite() {
const subscriptionId =
process.env["APPSERVICE_SUBSCRIPTION_ID"] || "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
const resourceGroupName = process.env["APPSERVICE_RESOURCE_GROUP"] || "rg";
const name = "testStaticSite0";
const domainName = "custom.domain.net";
const credential = new DefaultAzureCredential();
const client = new WebSiteManagementClient(credential, subscriptionId);
const result = await client.staticSites.beginDeleteStaticSiteCustomDomainAndWait(
resourceGroupName,
name,
domainName,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
Sample response
azure-asyncoperation: https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.Web/locations/westus2/operationResults/62e4d893-d233-4005-988e-a428d9f77076?api-version=2019-01-01
Definitions
DefaultErrorResponse
Object
App Service error response.
Name
Type
Description
error
Error
Error model.
Details
Object
Name
Type
Description
code
string
Standardized string to programmatically identify the error.
message
string
Detailed error description and debugging information.
target
string
Detailed error description and debugging information.
Error
Object
Error model.
Name
Type
Description
code
string
Standardized string to programmatically identify the error.
details
Details []
Detailed errors.
innererror
string
More information to debug error.
message
string
Detailed error description and debugging information.
target
string
Detailed error description and debugging information.