Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint in DNS.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability?api-version=2023-05-01
URI Parameters
Name |
In |
Required |
Type |
Description |
profileName
|
path |
True
|
string
|
Name of the Azure Front Door Standard or Azure Front Door Premium profile which is unique within the resource group.
|
resourceGroupName
|
path |
True
|
string
|
Name of the Resource group within the Azure subscription.
Regex pattern: ^[-\w\._\(\)]+$
|
subscriptionId
|
path |
True
|
string
|
Azure Subscription ID.
|
api-version
|
query |
True
|
string
|
Version of the API to be used with the client request. Current version is 2023-05-01.
|
Request Body
Name |
Required |
Type |
Description |
hostName
|
True
|
string
|
The host name to validate.
|
Responses
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
AFDProfiles_CheckHostNameAvailability
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/RG/providers/Microsoft.Cdn/profiles/profile1/checkHostNameAvailability?api-version=2023-05-01
{
"hostName": "www.someDomain.net"
}
import com.azure.resourcemanager.cdn.models.CheckHostnameAvailabilityInput;
/** Samples for AfdProfiles CheckHostnameAvailability. */
public final class Main {
/*
* x-ms-original-file:
* specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_CheckHostNameAvailability
* .json
*/
/**
* Sample code: AFDProfiles_CheckHostNameAvailability.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void aFDProfilesCheckHostNameAvailability(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cdnProfiles().manager().serviceClient().getAfdProfiles().checkHostnameAvailabilityWithResponse("RG",
"profile1", new CheckHostnameAvailabilityInput().withHostname("www.someDomain.net"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.cdn import CdnManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cdn
# USAGE
python afd_profiles_check_host_name_availability.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 = CdnManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.afd_profiles.check_host_name_availability(
resource_group_name="RG",
profile_name="profile1",
check_host_name_availability_input={"hostName": "www.someDomain.net"},
)
print(response)
# x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_CheckHostNameAvailability.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 armcdn_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cdn/armcdn/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7b551033155a63739b6d28f79b9c07569f6179b8/specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_CheckHostNameAvailability.json
func ExampleAFDProfilesClient_CheckHostNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcdn.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAFDProfilesClient().CheckHostNameAvailability(ctx, "RG", "profile1", armcdn.CheckHostNameAvailabilityInput{
HostName: to.Ptr("www.someDomain.net"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.CheckNameAvailabilityOutput = armcdn.CheckNameAvailabilityOutput{
// Message: to.Ptr("The hostname 'www.someDomain.net' is already owned by another profile."),
// NameAvailable: to.Ptr(false),
// Reason: to.Ptr("Conflict"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CdnManagementClient } = require("@azure/arm-cdn");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint in DNS.
*
* @summary Validates the custom domain mapping to ensure it maps to the correct Azure Front Door endpoint in DNS.
* x-ms-original-file: specification/cdn/resource-manager/Microsoft.Cdn/stable/2023-05-01/examples/AFDProfiles_CheckHostNameAvailability.json
*/
async function afdProfilesCheckHostNameAvailability() {
const subscriptionId = process.env["CDN_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["CDN_RESOURCE_GROUP"] || "RG";
const profileName = "profile1";
const checkHostNameAvailabilityInput = {
hostName: "www.someDomain.net",
};
const credential = new DefaultAzureCredential();
const client = new CdnManagementClient(credential, subscriptionId);
const result = await client.afdProfiles.checkHostNameAvailability(
resourceGroupName,
profileName,
checkHostNameAvailabilityInput
);
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
{
"nameAvailable": false,
"reason": "Conflict",
"message": "The hostname 'www.someDomain.net' is already owned by another profile."
}
Definitions
AfdErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
Input of CheckHostNameAvailability API.
Name |
Type |
Description |
hostName
|
string
|
The host name to validate.
|
CheckNameAvailabilityOutput
Output of check name availability API.
Name |
Type |
Description |
message
|
string
|
The detailed error message describing why the name is not available.
|
nameAvailable
|
boolean
|
Indicates whether the name is available.
|
reason
|
string
|
The reason why the name is not available.
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|