How to automate azure CDN service using powershell?

Harish Gangadhar 20 Reputation points
2023-03-23T15:57:26.0466667+00:00

Please let me know if you have any samples to automate CDN and Front Door using powershell scripts.

Azure Content Delivery Network
{count} votes

Answer accepted by question author
  1. Sedat SALMAN 14,280 Reputation points MVP Volunteer Moderator
    2023-03-23T19:45:56.4633333+00:00
    # Install Azure PowerShell module
    Install-Module -Name Az -AllowClobber -Scope CurrentUser
    # Log in to Azure
    Connect-AzAccount
    # Create Resource Group
    $resourceGroupName = "YourResourceGroupName"
    $location = "YourPreferredLocation"
    New-AzResourceGroup -Name $resourceGroupName -Location $location
    # Create CDN profile
    $cdnProfileName = "YourCDNProfileName"
    $sku = "Standard_Microsoft"
    New-AzCdnProfile -ResourceGroupName $resourceGroupName -Name $cdnProfileName -Sku $sku -Location $location
    # Create CDN endpoint
    $cdnEndpointName = "YourCDNEndpointName"
    $originHostName = "YourWebApp.azurewebsites.net"
    New-AzCdnEndpoint -ResourceGroupName $resourceGroupName -ProfileName $cdnProfileName -Name $cdnEndpointName -Location $location -OriginHostName $originHostName
    
    

1 additional answer

Sort by: Most helpful
  1. KapilAnanth 49,846 Reputation points Moderator
    2023-03-24T06:25:22.5266667+00:00

    @Harish Gangadhar

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to know how to manage Azure CDN and AFD using Powershell.

    Find the "How-to" of all the configurations for CDN below

    For AFD,

    1.Premium/Standard

    2.Classic

    Kindly let us know if this helps or you need further assistance on this issue.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.