"az afd rule create" is not working properly

Ramanarajan D 41 Reputation points
2026-08-08T08:19:48.4566667+00:00

Hello,

Recently, the Azure CLI CDN functionality was migrated, starting with CLI version 2.88.0. As a result, some of the parameters previously used in our pipeline are no longer available, causing the pipeline to fail.User's image

When I check the new documentation I got this

User's image

Old code:

az afd rule create \
                --name 'BlobContainer$(ticketID)' \
                --resource-group $(resourceGroupName) \
                --profile-name $(afdProfileName) \
                --action-name 'UrlRewrite' \
                --source-pattern / \
                --destination '/web-com-staticassets/' \
                --preserve-unmatched-path true \
                --rule-set-name 'staticassetsstorage$(ticketID)'

Now the options are moved inside --actions parameter. But it is not working . Please check the below screenshot.
User's image

Direct link of Azure CLI az afd rule documentation: https://learn.microsoft.com/en-us/cli/azure/afd/rule?view=azure-cli-latest#az-afd-rule-create

What is this Try "??" to show more?

User's image

How can I achieve my original requirement? please refer code block "Old code"

Azure Front Door
Azure Front Door

An Azure service that provides a cloud content delivery network with threat protection.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Allan Solomon Mejia 7,915 Reputation points
    2026-08-08T20:02:37.53+00:00

    Hello @Ramanarajan D

    Yes, what you're seeing is related to the Azure CLI CDN migration introduced with Azure CLI 2.88.0. Microsoft’s 2.88.0 release notes specifically state that the entire CDN module was migrated to azure-cli-extensions.

    Your previous command used the older flattened parameters:

    --action-name UrlRewrite

    --source-pattern /

    --destination '/web-com-staticassets/'

    --preserve-unmatched-path true

    With the current implementation, az afd rule create exposes the rule actions through the structured --actions parameter instead. The current documentation confirms that --actions accepts shorthand syntax, JSON, or YAML.

    For your particular case, though, I would avoid putting the complete action definition into az afd rule create. A cleaner approach with the new command structure is to create the rule first and then add the UrlRewrite action separately.

    For example:

    az afd rule create

    --name "BlobContainer$(ticketID)" \
    
    --resource-group "$(resourceGroupName)" \
    
    --profile-name "$(afdProfileName)" \
    
    --rule-set-name "staticassetsstorage$(ticketID)" \
    
    --order 0
    

    Then add the URL rewrite action:

    az afd rule action add

    --resource-group "$(resourceGroupName)" \
    
    --profile-name "$(afdProfileName)" \
    
    --rule-set-name "staticassetsstorage$(ticketID)" \
    
    --rule-name "BlobContainer$(ticketID)" \
    
    --action-name UrlRewrite \
    
    --url-rewrite "{sourcePattern:/,destination:/web-com-staticassets/,preserveUnmatchedPath:true}"
    

    The current CLI exposes az afd rule action add specifically for adding actions to an existing delivery rule, and UrlRewrite is one of the supported action types.

    Also note that order 0 has special behavior. Microsoft documents order 0 as a rule that does not require a condition, and its actions are always applied. Since your original rule doesn't contain a match condition, this is appropriate if the rewrite is intended to apply unconditionally.

    Regarding Try "??" to show more

    That message in the documentation isn't an error.

    It means that --actions, --conditions, --url-rewrite, and similar parameters are structured arguments rather than simple string parameters. Azure CLI's generated help can display the structure expected by these arguments.

    For example, try:

    az afd rule action add --action-name UrlRewrite --url-rewrite "??"

    This should show the fields accepted by the --url-rewrite object for the version of the CDN extension installed in your environment.

    I would also check the versions being used by the pipeline:

    az version

    az extension show --name cdn

    This is particularly important now because az afd is provided through the CDN extension. The current Microsoft documentation identifies az afd rule as part of that extension.

    If the command syntax still differs from the above, please post the output of:

    az version

    az extension show --name cdn

    az afd rule action add --help

    That will help determine whether the pipeline is loading a different CDN extension version than the documentation.

    Please "Accept the Answer" if this information helped you. This will help us and others in the community as well.

    Was this answer helpful?


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.