In my case, It works well when I used custom policy below.
※ This custom policy also constraints the location, so please use only what you need.
{
"mode": "Indexed",
"policyRule": {
"if": {
"allOf": [
{
"anyOf": [
{
"field": "location",
"notIn": "[parameters('listOfAllowedLocations')]"
},
{
"value": "[split(field('type'), '/')[0]]",
"notIn": "[parameters('listOfAllowedResourceProviders')]"
}
]
},
{
"field": "location",
"notEquals": "global"
},
{
"field": "type",
"notEquals": "Microsoft.AzureActiveDirectory/b2cDirectories"
}
]
},
"then": {
"effect": "deny"
}
},
"parameters": {
"listOfAllowedLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed locations",
"description": "The list of locations that can be specified when deploying resources.",
"strongType": "location"
}
},
"listOfAllowedResourceProviders": {
"type": "Array",
"metadata": {
"displayName": "Allowed resouce providers",
"description": "Allow only specific resource providers"
}
}
}
}

As shown in the picture above, you need to enter the name of the resource provider.