How do I update Front Door WAF policy programmatically?

vinayakshastri 25 Reputation points
2025-04-11T02:23:12.5733333+00:00

Whenever I try to update an existing Front Door WAF programmatically using the ResourceManagementClient using begin_create_or_update_by_id

I get an error Code: BadRequest Message: Property 'WebApplicationFirewallPolicy.sku' is read-only and cannot be changed.

The identity that has got the Network Contributor role on the Front Door WAF policy.

Am I missing out on something or is this an Azure issue?

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
858 questions
{count} votes

Accepted answer
  1. Sai Prasanna Sinde 6,645 Reputation points Microsoft External Staff Moderator
    2025-04-14T10:37:43.67+00:00

    Hi @Vinayak Udaykumar SHASTRI-

    Instead of the generic ResourceManagementClient, use the client specifically designed for Front Door. This is often found in packages like azure-mgmt-frontdoor or azure-mgmt-network.Look for a client like FrontDoorManagementClient or NetworkManagementClient

    Within that client, navigate to operations related to WAF policies. Look for a method like begin_create_or_update.

    Initiate the specific client and use the client's get method to fetch the current state of your WAF policy object.

    Modify the custom_rules property within the retrieved object in your Python code. Update the match_value list for your 'blocklist' rule.

    Use the clients begin_create_or_update method, passing the entire modified policy object back. The service-specific SDK is sometimes better at handling read-only properties correctly during this flow compared to the generic ResourceManagementClient.

    For your reference: https://learn.microsoft.com/en-us/powershell/module/az.frontdoor/update-azfrontdoorwafpolicy?view=azps-13.4.0


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

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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