Configure a Rule Set with Azure Front Door Standard/Premium (Preview)
Note
This documentation is for Azure Front Door Standard/Premium (Preview). Looking for information on Azure Front Door? View here.
This article shows how to create a Rule Set and your first set of rules in the Azure portal. You'll then learn how to associate the Rule Set to a route from the Rule Set page or from Endpoint Manager.
Important
Azure Front Door Standard/Premium (Preview) is currently in public preview. This preview version is provided without a service level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Prerequisites
- Before you can configure a Rule Set, you must first create an Azure Front Door Standard/Premium. For more information, see Quickstart: Create an Azure Front Door Standard/Premium profile.
Configure Rule Set in Azure portal
Within your Front Door profile, select Rule Set located under Settings. Select Add and give it a rule set name.
Select Add Rule to create your first rule. Give it a rule name. Then, select Add condition or Add action to define your rule. You can add up to 10 conditions and 5 actions for one rule. In this example, we use server variable to add a response header 8Geo-country* for requests that include contoso in the URL.
Note
- To delete a condition or action from a rule, use the trash can on the right-hand side of the specific condition or action.
- To create a rule that applies to all incoming traffic, do not specify any conditions.
- To stop evaluating remaining rules if a specific rule is met, check Stop evaluating remaining rule. If this option is checked and all remaining rules in the Rule Set will not be executed regardless if the matching conditions were met.
- All paths in Rules Engine are case sensitive.
- Header names should adhere to RFC 7230.
You can determine the priority of the rules within your Rule Set by using the arrow buttons to move the rules higher or lower in priority. The list is in ascending order, so the most important rule is listed first.
Tip
If you like to verify when the changes are propagated to Azure Front Door, you can create a custom response header in the rule using the example below. You can add a response header
_X-<RuleName>-Version_and change the value each time rule is updated.
After the changes are updated, you can go to the URL to confirm the rule version being invoked:
Once you've created one or more rules select Save to complete the creation of your Rule Set.
Now associate the Rule Set to a Route so it can take effect. You can associate the Rules Set through Rule Set page or you can go to Endpoint Manager to create the association.
Rule Set page:
Select the Rule Set to be associated.
Select the Unassociated link.
Then in the Associate a route page, select the endpoint and route you want to associate with the Rule Set.
Select Next to change rule set orders if there are multiple rule sets under selected route. Rule set will be executed from top to down. You can change orders by selecting the rule set and move it up or down. Then select Associate.
Note
You can only associate one rule set with a single route on this page. To associate a Rule Set with multiple routes, please use Endpoint Manager.
The rule set is now associated with a route. You can look at the response header and see the Geo-country is added.
Endpoint Manager:
Go to Endpoint manager, select the endpoint you want to associate with the Rule Set.
Select Edit endpoint.
Select the Route.
On the Update route page, in Rules, select the Rule Sets you want to associate with the route from the dropdown. Then you can change orders by moving rule set up and down.
Then select Update or Add to finish the association.
Delete a Rule Set from your Azure Front Door profile
In the preceding steps, you configured and associated a Rule Set to your Route. If you no longer want the Rule Set associated to your Front Door, you can remove the Rule Set by completing the following steps:
Go to the Rule Set page under Settings to disassociate the Rule Set from all associated routes.
Expand the Route, select the three dots. Then select Edit the route.
Go to Rules section on the Route page, select the rule set, and select on the Delete button.
Select Update and the Rule Set will disassociate from the route.
Repeat steps 2-5 to disassociate other routes that are associated with this rule set until you see the Routes status shows Unassociated.
For Rule Set that is Unassociated, you can delete the Rule Set by clicking on the three dots on the right and select Delete.
The rule set is now deleted.
Next steps
Learn how to add Security headers with Rules Set.