-
Notifications
You must be signed in to change notification settings - Fork 1
/
AzureCDN.ps1
41 lines (35 loc) · 1.12 KB
/
AzureCDN.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Create new CDN profile
New-AzCdnProfile `
-ProfileName ncstoragecdn `
-Location 'West Europe' `
-Sku Standard_Akamai `
-ResourceGroupName nc-storage-rg
# Create a new Azure CDN endpoint within the new
# CDN profile just created
New-AzCdnEndpoint `
-ProfileName ncstoragecdn `
-EndpointName ncstoragecdn `
-ResourceGroupName nc-storage-rg `
-Location 'West Europe' `
-OriginName ncstoragecdn `
-OriginHostName ncstoragecdn.blob.core.windows.net `
-IsHttpAllowed:$false
# List all profile endpoints
Get-AzCdnProfile | Get-AzCdnEndpoint
# Get existing CDN endpoint
$Endpoint = Get-AzCdnEndpoint `
-EndpointName ncstoragecdn `
-ProfileName ncstoragecdn `
-ResourceGroupName nc-storage-rg
# Set new properties and update
$Endpoint.OriginHostHeader = "ncstoragecdn.blob.core.windows.net"
$Endpoint | Set-AzCdnEndpoint
# First, we remove the endpoint
Remove-AzCdnEndpoint `
-EndpointName ncstoragecdn `
-ProfileName ncstoragecdn `
-ResourceGroupName nc-storage-rg
# Now, remove profile
Remove-AzCdnProfile `
-ProfileName ncstoragecdn `
-ResourceGroupName nc-storage-rg