다음을 통해 공유


Azure CLI를 사용하여 Azure Content Delivery Network 프로필 및 엔드포인트 만들기

Azure Portal 대신 이러한 샘플 Azure CLI 스크립트를 사용하여 다음 콘텐츠 배달 네트워크 작업을 관리할 수 있습니다.

  • 콘텐츠 배달 네트워크 프로필을 만듭니다.
  • 콘텐츠 배달 네트워크 엔드포인트를 만듭니다.
  • 콘텐츠 배달 네트워크 원본 그룹을 만들고 기본 그룹으로 만듭니다.
  • 콘텐츠 배달 네트워크 원본을 만듭니다.
  • 사용자 지정 도메인을 만들고 HTTPS를 사용하도록 설정합니다.

사전 요구 사항

샘플 스크립트

콘텐츠 배달 네트워크 프로필에 대한 리소스 그룹이 아직 없는 경우 다음 명령을 az group create사용하여 만듭니다.

# Create a resource group to use for the content delivery network.
az group create --name MyResourceGroup --location eastus

다음 Azure CLI 스크립트는 콘텐츠 배달 네트워크 프로필 및 콘텐츠 배달 네트워크 엔드포인트를 만듭니다.

# Create a content delivery network profile.
az cdn profile create --resource-group MyResourceGroup --name MyCDNProfile --sku Standard_Microsoft

# Create a content delivery network endpoint.
az cdn endpoint create --resource-group MyResourceGroup --name MyCDNEndpoint --profile-name MyCDNProfile --origin www.contoso.com

다음 Azure CLI 스크립트는 콘텐츠 배달 네트워크 원본 그룹을 만들고, 엔드포인트의 기본 원본 그룹을 설정하고, 새 원본을 만듭니다.

# Create an origin group.
az cdn origin-group create --resource-group MyResourceGroup --endpoint-name MyCDNEndpoint --profile-name MyCDNProfile --name MyOriginGroup --origins origin-0

# Make the origin group the default group of an endpoint.
az cdn endpoint update --resource-group MyResourceGroup --name MyCDNEndpoint --profile-name MyCDNProfile --default-origin-group MyOriginGroup

# Create another origin for an endpoint.
az cdn origin create --resource-group MyResourceGroup --endpoint-name MyCDNEndpoint --profile-name MyCDNProfile --name origin-1 --host-name example.contoso.com

다음 Azure CLI 스크립트는 콘텐츠 배달 네트워크 사용자 지정 작업을 만들고기본 HTTPS를 사용하도록 설정합니다. 사용자 지정기본 작업을 Azure 콘텐츠 배달 네트워크 엔드포인트와 연결하려면 먼저 Azure DNS 또는 DNS 공급자를 사용하여 CNAME(정식 이름) 레코드를 만들어 콘텐츠 배달 네트워크 엔드포인트를 가리킵니다. 자세한 내용은 CNAME DNS 레코드 만들기를 참조하세요.

# Associate a custom domain with an endpoint.
az cdn custom-domain create --resource-group MyResourceGroup --endpoint-name MyCDNEndpoint --profile-name MyCDNProfile --name MyCustomDomain --hostname www.example.com

# Enable HTTPS on the custom domain.
az cdn custom-domain enable-https --resource-group MyResourceGroup --endpoint-name MyCDNEndpoint --profile-name MyCDNProfile --name MyCustomDomain

리소스 정리

샘플 스크립트 실행을 완료한 후에는 다음 명령을 사용하여 리소스 그룹 및 해당 그룹에 연결된 모든 리소스를 제거합니다.

# Delete the resource group.
az group delete --name MyResourceGroup

이 문서에 사용된 Azure CLI 명령