Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Important
- Ab dem 15. August 2025 unterstützt Azure CDN von Microsoft (klassisch) das Onboarding oder die Profilerstellung für neue Domänen nicht mehr. Migrieren Sie zu AFD Standard und Premium , um neue Domänen oder Profile zu erstellen und Dienstunterbrechungen zu vermeiden. Weitere Informationen
- Ab dem 15. August 2025 unterstützt Azure CDN von Microsoft (klassisch) keine verwalteten Zertifikate mehr. Um Dienstunterbrechungen zu vermeiden, wechseln Sie entweder zu Bring Your Own Certificate (BYOC) oder migrieren Sie bis zu diesem Datum zu AFD Standard und Premium . Vorhandene verwaltete Zertifikate werden vor dem 15. August 2025 automatisch verlängert und bleiben bis zum 14. April 2026 gültig. Weitere Informationen
- Azure CDN Standard von Microsoft (klassisch) wird am 30. September 2027 eingestellt. Um Dienstunterbrechungen zu vermeiden, migrieren Sie zu AFD Standard oder Premium. Weitere Informationen.
- Azure CDN von Edgio wurde am 15. Januar 2025 eingestellt. Weitere Informationen.
PowerShell bietet eine der flexibelsten Methoden zur Verwaltung Ihrer Azure Content Delivery Network-Profile und -Endpunkte. Sie können PowerShell interaktiv oder durch Schreiben von Skripts verwenden, um Verwaltungsaufgaben zu automatisieren. Dieses Tutorial demonstriert einige der häufigsten Aufgaben, die Sie mit PowerShell durchführen können, um Ihre Azure Content Delivery Network-Profile und Endpunkte zu verwalten.
Prerequisites
Note
Es wird empfohlen, das Azure Az PowerShell-Modul für die Interaktion mit Azure zu verwenden. Informationen zu den ersten Schritten finden Sie unter Installieren von Azure PowerShell. Informationen zum Migrieren zum Az PowerShell-Modul finden Sie unter Migrieren von Azure PowerShell von AzureRM zum Az-Modul.
Um PowerShell für die Verwaltung Ihrer Azure Content Delivery Network-Profile und -Endpunkte zu verwenden, müssen Sie das Azure PowerShell-Modul installiert haben. Informationen zum Installieren von Azure PowerShell und zum Herstellen einer Verbindung mit Azure mithilfe des Connect-AzAccount -Cmdlets finden Sie unter Installieren und Konfigurieren von Azure PowerShell.
Important
Melden Sie sich mit Connect-AzAccount an, um Azure PowerShell-Cmdlets ausführen zu können.
Auflisten der Azure Content Delivery Network-Cmdlets
Sie können alle Azure Content Delivery Network-Cmdlets mithilfe des Get-Command-Cmdlets auflisten.
PS C:\> Get-Command -Module Az.Cdn
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Confirm-AzCdnEndpointProbeURL 2.1.0 Az.Cdn
Cmdlet Disable-AzCdnCustomDomain 2.1.0 Az.Cdn
Cmdlet Disable-AzCdnCustomDomainHttps 2.1.0 Az.Cdn
Cmdlet Enable-AzCdnCustomDomain 2.1.0 Az.Cdn
Cmdlet Enable-AzCdnCustomDomainHttps 2.1.0 Az.Cdn
Cmdlet Get-AzCdnCustomDomain 2.1.0 Az.Cdn
Cmdlet Get-AzCdnEdgeNode 2.1.0 Az.Cdn
Cmdlet Get-AzCdnEndpoint 2.1.0 Az.Cdn
Cmdlet Get-AzCdnEndpointResourceUsage 2.1.0 Az.Cdn
Cmdlet Get-AzCdnOrigin 2.1.0 Az.Cdn
Cmdlet Get-AzCdnProfile 2.1.0 Az.Cdn
Cmdlet Get-AzCdnProfileResourceUsage 2.1.0 Az.Cdn
Cmdlet Get-AzCdnProfileSupportedOptimizationType 2.1.0 Az.Cdn
Cmdlet Get-AzCdnSubscriptionResourceUsage 2.1.0 Az.Cdn
Cmdlet New-AzCdnCustomDomain 2.1.0 Az.Cdn
Cmdlet New-AzCdnDeliveryPolicy 2.1.0 Az.Cdn
Cmdlet New-AzCdnDeliveryRule 2.1.0 Az.Cdn
Cmdlet New-AzCdnDeliveryRuleAction 2.1.0 Az.Cdn
Cmdlet New-AzCdnDeliveryRuleCondition 2.1.0 Az.Cdn
Cmdlet New-AzCdnEndpoint 2.1.0 Az.Cdn
Cmdlet New-AzCdnProfile 2.1.0 Az.Cdn
Cmdlet Remove-AzCdnCustomDomain 2.1.0 Az.Cdn
Cmdlet Remove-AzCdnEndpoint 2.1.0 Az.Cdn
Cmdlet Remove-AzCdnProfile 2.1.0 Az.Cdn
Cmdlet Set-AzCdnProfile 2.1.0 Az.Cdn
Cmdlet Start-AzCdnEndpoint 2.1.0 Az.Cdn
Cmdlet Stop-AzCdnEndpoint 2.1.0 Az.Cdn
Hilfe erhalten
Mit dem Get-Help -Cmdlet können Sie Hilfe zu allen diesen Cmdlets aufrufen. Get-Help bietet Verwendung und Syntax und zeigt optional Beispiele.
PS C:\> Get-Help Get-AzCdnProfile
NAME
Get-AzCdnProfile
SYNOPSIS
Gets an Azure CDN profile.
SYNTAX
Get-AzCdnProfile [-ProfileName <String>] [-ResourceGroupName <String>] [-InformationAction
<ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]
DESCRIPTION
Gets an Azure CDN profile and all related information.
RELATED LINKS
https://learn.microsoft.com/powershell/module/az.cdn/get-azcdnprofile
REMARKS
To see the examples, type: "get-help Get-AzCdnProfile -examples".
For more information, type: "get-help Get-AzCdnProfile -detailed".
For technical information, type: "get-help Get-AzCdnProfile -full".
For online help, type: "get-help Get-AzCdnProfile -online"
Auflisten vorhandener Azure Content Delivery Network-Profile
Das Get-AzCdnProfile-Cmdlet ohne Parameter ruft alle vorhandenen Netzwerkprofile für die Inhaltsübermittlung ab.
Get-AzCdnProfile
Diese Ausgabe kann zur Enumeration an Cmdlets übergeben werden.
# Output the name of all profiles on this subscription.
Get-AzCdnProfile | ForEach-Object { Write-Host $_.Name }
Sie können auch ein einzelnes Profil zurückgeben, indem Sie den Profilnamen und die Ressourcengruppe angeben.
Get-AzCdnProfile -ProfileName CdnDemo -ResourceGroupName CdnDemoRG
Tip
Es ist möglich, mehrere Content-Delivery-Network-Profile mit demselben Namen zu haben, solange sie sich in verschiedenen Ressourcengruppen befinden. Durch Auslassen des Parameters ResourceGroupName werden alle Profile mit dem gleichen Namen zurückgegeben.
Auflisten vorhandener Endpunkte für die Inhaltsübermittlung
Get-AzCdnEndpoint kann einen einzelnen Endpunkt oder alle Endpunkte in einem Profil abrufen.
# Get a single endpoint.
Get-AzCdnEndpoint -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo
# Get all of the endpoints on a given profile.
Get-AzCdnEndpoint -ProfileName CdnDemo -ResourceGroupName CdnDemoRG
Erstellen von Netzwerkprofilen und Endpunkten für die Inhaltsübermittlung
New-AzCdnProfile und New-AzCdnEndpoint werden verwendet, um Netzwerkprofile und Endpunkte für die Inhaltsübermittlung zu erstellen. Die folgenden SKUs werden unterstützt:
- Standard_Verizon
- Premium_Verizon
- Custom_Verizon
- Standard_Microsoft
- Standard_ChinaCdn
# Create a new profile
New-AzCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Sku Standard_Microsoft -Location "Central US"
# Create a new endpoint
$origin = @{
Name = "Contoso"
HostName = "www.contoso.com"
};
New-AzCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Location "Central US" -EndpointName cdnposhdoc -Origin $origin
Hinzufügen einer benutzerdefinierten Domäne
New-AzCdnCustomDomain fügt einem vorhandenen Endpunkt den Namen einer benutzerdefinierten Domäne hinzu.
Important
Sie müssen den CNAME bei Ihrem DNS-Anbieter einrichten, wie unter So ordnen Sie eine benutzerdefinierte Domäne einem Content Delivery Network-Endpunkt zu. Sie können die Zuordnung mithilfe von Test-AzCdnCustomDomain testen, bevor Sie den Endpunkt ändern.
# Create the custom domain on the endpoint
New-AzCdnCustomDomain -ResourceGroupName CdnDemoRG -ProfileName CdnPoshDemo -Name contoso -HostName "cdn.contoso.com" -EndpointName cdnposhdoc
Ändern eines Endpunkts
Update-AzCdnEndpoint ändert einen vorhandenen Endpunkt.
# Update endpoint with compression settings
Update-AzCdnEndpoint -Name cdnposhdoc -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -IsCompressionEnabled -ContentTypesToCompress "text/javascript","text/css","application/json"
Purging
Clear-AzCdnEndpointContent löscht zwischengespeicherte Ressourcen.
# Purge some assets.
Clear-AzCdnEndpointContent -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -EndpointName cdnposhdoc -ContentFilePath @("/images/kitten.png","/video/rickroll.mp4")
Starten/Beenden von Endpunkten des Inhaltsübermittlungsnetzwerks
Start-AzCdnEndpoint und Stop-AzCdnEndpoint können zum Starten und Beenden von einzelnen Endpunkten oder Gruppen mit Endpunkten verwendet werden.
# Stop the CdnPoshDemo endpoint
Stop-AzCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Name cdnposhdoc
# Start the CdnPoshDemo endpoint
Start-AzCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Name cdnposhdoc
Erstellen einer Standardregel-Modulrichtlinie und Anwenden auf einen vorhandenen Endpunkt für die Inhaltsübermittlung
Die folgende Liste von Cmdlets kann verwendet werden, um eine Standard Rules Engine-Richtlinie zu erstellen und sie auf einen vorhandenen Content Delivery Network-Endpunkt anzuwenden.
Conditions:
- New-AzFrontDoorCdnRuleCookiesConditionObject
- New-AzCdnDeliveryRuleHttpVersionConditionObject
- New-AzCdnDeliveryRuleIsDeviceConditionObject
- New-AzCdnDeliveryRulePostArgsConditionObject
- New-AzCdnDeliveryRuleQueryStringConditionObject
- New-AzCdnDeliveryRuleRemoteAddressConditionObject
- New-AzCdnDeliveryRuleRequestBodyConditionObject
- New-AzCdnDeliveryRuleRequestHeaderConditionObject
- New-AzCdnDeliveryRuleRequestMethodConditionObject
- New-AzCdnDeliveryRuleRequestSchemeConditionObject
- New-AzCdnDeliveryRuleRequestUriConditionObject
- New-AzCdnDeliveryRuleResponseHeaderActionObject
- New-AzCdnDeliveryRuleUrlFileExtensionConditionObject
- New-AzCdnDeliveryRuleUrlFileNameConditionObject
- New-AzCdnDeliveryRuleUrlPathConditionObject
Actions:
- New-AzCdnDeliveryRuleRequestHeaderActionObject
- New-AzCdnDeliveryRuleRequestHeaderActionObject
- New-AzCdnUrlRedirectActionObject
- New-AzCdnUrlRewriteActionObject
- New-AzCdnUrlSigningActionObject
# Create a path based Response header modification rule.
$cond1 = New-AzCdnDeliveryRuleUrlPathConditionObject -Name UrlPath -ParameterOperator BeginsWith -ParameterMatchValue "/images/"
$action1 = New-AzCdnDeliveryRuleResponseHeaderActionObject -Name ModifyResponseHeader -ParameterHeaderAction Overwrite -ParameterHeaderName "Access-Control-Allow-Origin" -ParameterValue "*"
$rule1 = New-AzCdnDeliveryRuleObject -Name "PathBasedCacheOverride" -Order 1 -Condition $cond1 -Action $action1
# Create a new http to https redirect rule
$cond1 = New-AzCdnDeliveryRuleRequestSchemeConditionObject -Name RequestScheme -ParameterMatchValue HTTPS
$action1 = New-AzCdnUrlRedirectActionObject -Name UrlRedirect -ParameterRedirectType Found -ParameterDestinationProtocol Https
$rule2 = New-AzCdnDeliveryRuleObject -Name "UrlRewriteRule" -Order 2 -Condition $cond1 -Action $action1
# Update existing endpoint with new rules
Update-AzCdnEndpoint -Name cdnposhdoc -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -DeliveryPolicyRule $rule1,$rule2
Löschen von Netzwerkressourcen für die Inhaltsübermittlung
Remove-AzCdnProfile und Remove-AzCdnEndpoint können zum Entfernen von Profilen und Endpunkten verwendet werden.
# Remove a single endpoint
Remove-AzCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -EndpointName cdnposhdoc
# Remove a single profile
Remove-AzCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG
Nächste Schritte
Erfahren Sie, wie Sie das Azure Content Delivery Network mit .NET oder Node.js automatisieren.
Informationen zu Netzwerkfeatures für die Inhaltsübermittlung finden Sie unter Übersicht über das Content Delivery Network.