Obtención de nombres de host personalizados en esta suscripción
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites?api-version=2023-01-01
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites?hostname={hostname}&api-version=2023-01-01
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
subscriptionId
|
path |
True
|
string
|
Su identificador de suscripción de Azure. Se trata de una cadena con formato GUID (por ejemplo, 000000000-0000-0000-0000-00000000000000).
|
api-version
|
query |
True
|
string
|
Versión de la API
|
hostname
|
query |
|
string
|
Nombre de host específico
|
Respuestas
Seguridad
azure_auth
Flujo OAuth2 de Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nombre |
Description |
user_impersonation
|
suplantación de su cuenta de usuario
|
Ejemplos
Get custom hostnames under subscription
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites?api-version=2023-01-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.web import WebSiteManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-web
# USAGE
python list_custom_host_name_sites.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="00000000-0000-0000-0000-000000000000",
)
response = client.list_custom_host_name_sites()
for item in response:
print(item)
# x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/examples/ListCustomHostNameSites.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/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/738ab25fe76324897f273645906d4a0415068a6c/specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/examples/ListCustomHostNameSites.json
func ExampleWebSiteManagementClient_NewListCustomHostNameSitesPager_getCustomHostnamesUnderSubscription() {
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)
}
pager := clientFactory.NewWebSiteManagementClient().NewListCustomHostNameSitesPager(&armappservice.WebSiteManagementClientListCustomHostNameSitesOptions{Hostname: nil})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.CustomHostnameSitesCollection = armappservice.CustomHostnameSitesCollection{
// Value: []*armappservice.CustomHostnameSites{
// {
// Name: to.Ptr("mywebapp.azurewebsites.net"),
// Type: to.Ptr("Microsoft.Web/customhostnameSites"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites/mywebapp.azurewebsites.net"),
// Properties: &armappservice.CustomHostnameSitesProperties{
// CustomHostname: to.Ptr("mywebapp.azurewebsites.net"),
// Region: to.Ptr("West US"),
// SiteResourceIDs: []*armappservice.Identifier{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus-rg/providers/Microsoft.Web/sites/mywebapp"),
// }},
// },
// },
// {
// Name: to.Ptr("www.example.com"),
// Type: to.Ptr("Microsoft.Web/customhostnameSites"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites/www.example.com"),
// Properties: &armappservice.CustomHostnameSitesProperties{
// CustomHostname: to.Ptr("www.example.com"),
// Region: to.Ptr("West US 2"),
// SiteResourceIDs: []*armappservice.Identifier{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app1"),
// },
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app2"),
// },
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app3"),
// }},
// },
// }},
// }
}
}
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");
/**
* This sample demonstrates how to Get custom hostnames under this subscription
*
* @summary Get custom hostnames under this subscription
* x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/examples/ListCustomHostNameSites.json
*/
async function getCustomHostnamesUnderSubscription() {
const subscriptionId =
process.env["APPSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new WebSiteManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.listCustomHostNameSites()) {
resArray.push(item);
}
console.log(resArray);
}
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
{
"value": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites/mywebapp.azurewebsites.net",
"name": "mywebapp.azurewebsites.net",
"type": "Microsoft.Web/customhostnameSites",
"properties": {
"customHostname": "mywebapp.azurewebsites.net",
"region": "West US",
"siteResourceIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus-rg/providers/Microsoft.Web/sites/mywebapp"
}
]
}
},
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites/www.example.com",
"name": "www.example.com",
"type": "Microsoft.Web/customhostnameSites",
"properties": {
"customHostname": "www.example.com",
"region": "West US 2",
"siteResourceIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app1"
},
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app2"
},
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app3"
}
]
}
}
],
"nextLink": null
}
Get specific custom hostname under subscription
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites?hostname=www.example.com&api-version=2023-01-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.web import WebSiteManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-web
# USAGE
python list_custom_specific_host_name_sites.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="00000000-0000-0000-0000-000000000000",
)
response = client.list_custom_host_name_sites()
for item in response:
print(item)
# x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/examples/ListCustomSpecificHostNameSites.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/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appservice/armappservice/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/738ab25fe76324897f273645906d4a0415068a6c/specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/examples/ListCustomSpecificHostNameSites.json
func ExampleWebSiteManagementClient_NewListCustomHostNameSitesPager_getSpecificCustomHostnameUnderSubscription() {
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)
}
pager := clientFactory.NewWebSiteManagementClient().NewListCustomHostNameSitesPager(&armappservice.WebSiteManagementClientListCustomHostNameSitesOptions{Hostname: to.Ptr("www.example.com")})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.CustomHostnameSitesCollection = armappservice.CustomHostnameSitesCollection{
// Value: []*armappservice.CustomHostnameSites{
// {
// Name: to.Ptr("www.example.com"),
// Type: to.Ptr("Microsoft.Web/customhostnameSites"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites/www.example.com"),
// Properties: &armappservice.CustomHostnameSitesProperties{
// CustomHostname: to.Ptr("www.example.com"),
// Region: to.Ptr("West US 2"),
// SiteResourceIDs: []*armappservice.Identifier{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app1"),
// },
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app2"),
// },
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app3"),
// }},
// },
// }},
// }
}
}
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");
/**
* This sample demonstrates how to Get custom hostnames under this subscription
*
* @summary Get custom hostnames under this subscription
* x-ms-original-file: specification/web/resource-manager/Microsoft.Web/stable/2023-01-01/examples/ListCustomSpecificHostNameSites.json
*/
async function getSpecificCustomHostnameUnderSubscription() {
const subscriptionId =
process.env["APPSERVICE_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const hostname = "www.example.com";
const options = { hostname };
const credential = new DefaultAzureCredential();
const client = new WebSiteManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.listCustomHostNameSites(options)) {
resArray.push(item);
}
console.log(resArray);
}
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
{
"value": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Web/customhostnameSites/www.example.com",
"name": "www.example.com",
"type": "Microsoft.Web/customhostnameSites",
"properties": {
"customHostname": "www.example.com",
"region": "West US 2",
"siteResourceIds": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app1"
},
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app2"
},
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/westus2-rg/providers/Microsoft.Web/sites/westus2app3"
}
]
}
}
],
"nextLink": null
}
Definiciones
CustomHostnameSites
Un nombre de host y sus sitios asignados
Nombre |
Tipo |
Description |
id
|
string
|
Id. de recurso.
|
kind
|
string
|
Tipo de recurso.
|
name
|
string
|
Nombre del recurso.
|
properties.customHostname
|
string
|
|
properties.region
|
string
|
|
properties.siteResourceIds
|
Identifier[]
|
Identificador de recursos específico del dominio.
|
type
|
string
|
Tipo de recurso.
|
CustomHostnameSitesCollection
Colección de sitios de nombre de host personalizados
Nombre |
Tipo |
Description |
nextLink
|
string
|
Vínculo a la página siguiente de recursos.
|
value
|
CustomHostnameSites[]
|
Colección de recursos.
|
DefaultErrorResponse
App Service respuesta de error.
Nombre |
Tipo |
Description |
error
|
Error
|
Modelo de error.
|
Details
Nombre |
Tipo |
Description |
code
|
string
|
Cadena estandarizada para identificar mediante programación el error.
|
message
|
string
|
Descripción detallada del error e información de depuración.
|
target
|
string
|
Descripción detallada del error e información de depuración.
|
Error
Modelo de error.
Nombre |
Tipo |
Description |
code
|
string
|
Cadena estandarizada para identificar mediante programación el error.
|
details
|
Details[]
|
Errores detallados.
|
innererror
|
string
|
Más información para depurar el error.
|
message
|
string
|
Descripción detallada del error e información de depuración.
|
target
|
string
|
Descripción detallada del error e información de depuración.
|
Identifier
Identificador de recursos específico del dominio.
Nombre |
Tipo |
Description |
id
|
string
|
Id. de recurso.
|
kind
|
string
|
Tipo de recurso.
|
name
|
string
|
Nombre del recurso.
|
properties.id
|
string
|
Representación de cadena de la identidad.
|
type
|
string
|
Tipo de recurso.
|