Obter nomes de anfitrião personalizados nesta subscrição
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 do URI
Name |
Em |
Necessário |
Tipo |
Description |
subscriptionId
|
path |
True
|
string
|
O seu ID de subscrição do Azure. Esta é uma cadeia formatada com GUID (por exemplo, 000000000-0000-0000-0000-000000000000).
|
api-version
|
query |
True
|
string
|
Versão da API
|
hostname
|
query |
|
string
|
Nome de anfitrião específico
|
Respostas
Segurança
azure_auth
Fluxo OAuth2 do Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
representar a sua conta de utilizador
|
Exemplos
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
}
Definições
CustomHostnameSites
Um nome de anfitrião e os respetivos sites atribuídos
Name |
Tipo |
Description |
id
|
string
|
ID do Recurso.
|
kind
|
string
|
Tipo de recurso.
|
name
|
string
|
Nome do Recurso.
|
properties.customHostname
|
string
|
|
properties.region
|
string
|
|
properties.siteResourceIds
|
Identifier[]
|
Um identificador de recurso específico do domínio.
|
type
|
string
|
Tipo de recurso.
|
CustomHostnameSitesCollection
Coleção de sites de nomes de anfitrião personalizados
Name |
Tipo |
Description |
nextLink
|
string
|
Ligação para a página seguinte de recursos.
|
value
|
CustomHostnameSites[]
|
Coleção de recursos.
|
DefaultErrorResponse
Serviço de Aplicações resposta de erro.
Name |
Tipo |
Description |
error
|
Error
|
Modelo de erro.
|
Details
Name |
Tipo |
Description |
code
|
string
|
Cadeia padronizada para identificar programaticamente o erro.
|
message
|
string
|
Descrição detalhada do erro e informações de depuração.
|
target
|
string
|
Descrição detalhada do erro e informações de depuração.
|
Error
Modelo de erro.
Name |
Tipo |
Description |
code
|
string
|
Cadeia padronizada para identificar programaticamente o erro.
|
details
|
Details[]
|
Erros detalhados.
|
innererror
|
string
|
Mais informações para depurar o erro.
|
message
|
string
|
Descrição detalhada do erro e informações de depuração.
|
target
|
string
|
Descrição detalhada do erro e informações de depuração.
|
Identifier
Um identificador de recurso específico do domínio.
Name |
Tipo |
Description |
id
|
string
|
ID do Recurso.
|
kind
|
string
|
Tipo de recurso.
|
name
|
string
|
Nome do Recurso.
|
properties.id
|
string
|
Representação de cadeia da identidade.
|
type
|
string
|
Tipo de recurso.
|