Deploy associations for a custom provider using Azure Policy
Azure policies can be used to deploy associations to associate resources to a custom provider. In this article, we describe a built-in policy that deploys associations and how you can use that policy.
Built-in policy to deploy associations
Deploy associations for a custom provider is a built-in policy that can be used to deploy association to associate a resource to a custom provider. The policy accepts three parameters:
- Custom provider ID - This ID is the resource ID of the custom provider to which the resources need to be associated.
- Resource types to associate - These resource types are the list of resource types to be associated to the custom provider. You can associate multiple resource types to a custom provider using the same policy.
- Association name prefix - This string is the prefix to be added to the name of the association resource being created. The default value is "DeployedByPolicy".
The policy uses DeployIfNotExists evaluation. It runs after a Resource Provider has handled a create or update resource request and the evaluation has returned a success status code. After that, the association resource gets deployed using a template deployment. For more information on associations, see Azure Custom Providers resource onboarding
How to use the deploy associations built-in policy
Prerequisites
If the custom provider needs permissions to the scope of the policy to perform an action, the policy deployment of association resource wouldn't work without granting the permissions.
Policy assignment
To use the built-in policy, create a policy assignment and assign the Deploy associations for a custom provider policy. The policy will then identify non-compliant resources and deploy association for those resources.

Getting help
If you have questions about Azure Custom Resource Providers development, try asking them on Stack Overflow. A similar question might have already been answered, so check first before posting. Add the tag azure-custom-providers to get a fast response!
Next steps
In this article, you learnt about using built-in policy to deploy associations. See these articles to learn more:
- Concepts: Azure Custom Providers resource onboarding
- Tutorial: Resource onboarding with custom providers
- Tutorial: Create custom actions and resources in Azure
- Quickstart: Create a custom resource provider and deploy custom resources
- How to: Adding custom actions to an Azure REST API
- How to: Adding custom resources to an Azure REST API
Tilbakemeldinger
Send inn og vis tilbakemelding for