azurerm and azapi Terraform providers do, the next question is: when should you use each? This guide focuses on practical decision-making to help you choose the right provider for the task—rather than relying on habit or guessing.
Use this guidance to reduce risk, improve maintainability, and keep your Terraform code aligned with Azure features and lifecycle practices.
Quick decision summary
- Prefer
azurermfor standard, well-supported Azure resources where stability, validation, and long-term maintainability matter. - Use
azapias an escape hatch whenazurermdoes not yet support a resource or property (including preview APIs), or when you need immediate access to specific ARM features. - Mix both providers in the same configuration when appropriate:
azurermfor most resources,azapionly where necessary.
High-level comparison
Below is a concise comparison of the most important criteria to consider when choosing betweenazurerm and azapi.

Detailed guidance
Resource schema and validationazurermis strongly typed: the provider exposes documented arguments and types for each resource. This enables provider-side validation, clearer error messages, and better editor autocompletion.azapitreats the ARM resource body as a payload. Terraform (viaazapi) performs minimal schema validation for ARM properties and forwards the JSON to Azure Resource Manager (ARM). This gives flexibility but removes many safety nets.
azurerm: many mistakes are caught interraform planbefore modifications reach Azure.azapi: you are more likely to encounter validation errors atterraform apply(or later), so authors must validate ARM properties and API version choices carefully.
azurerm: waits for provider maintainers to model new Azure features. There can be a delay between the ARM API release andazurermsupport.azapi: can target the ARM API version you need and access new or preview functionality immediately.
azurerm: better for most teams—well-documented, consistent patterns, and lower cognitive load.azapi: better for advanced scenarios where direct ARM control is required. Expect to author JSON blocks, choose API versions explicitly, and handle raw ARM property shapes.
azurerm: generally the safer choice for production workloads.azapi: powerful but riskier when used with preview APIs or unstable ARM endpoints. Use with caution and document intent.
Combining providers (recommended pattern)
You do not need to pick one provider for everything. A pragmatic pattern:- Use
azurermfor the majority of resources—those that are supported, stable, and commonly managed. - Introduce
azapionly for:- Resources not yet implemented in
azurerm. - Features only exposed in preview APIs.
- Cases where you need to set ARM properties that
azurermdoes not expose.
- Resources not yet implemented in
Best practices
- Prefer
azurermby default to reduce complexity and operational risk. - Restrict
azapiusage to well-justified exceptions. Keep such usages minimal and isolated. - Document every
azapiresource with:- The exact ARM resource type (e.g.,
Microsoft.Service/resourceType). - The targeted ARM API version.
- The concrete reason
azurermcouldn’t be used.
- The exact ARM resource type (e.g.,
- Validate
azapiconfigurations against the ARM API reference and test in non-production environments. - Use version control and code reviews to ensure
azapipayloads remain maintainable. - Periodically review
azapiresources—migrate them toazurermif/when provider support becomes available.
Prefer
azurerm by default. Use azapi as an escape hatch for missing or preview features, and document each azapi usage with the targeted ARM API version and the reason it was chosen.When to choose which provider — short checklist
-
Choose
azurermwhen:- The resource is supported by the provider.
- You want provider-side validation and safer
planbehavior. - You need stability and maintainability for production workloads.
-
Choose
azapiwhen:- The resource or property is not yet supported in
azurerm. - You must use a preview or very recent ARM API.
- You require direct access to ARM properties not surfaced by
azurerm.
- The resource or property is not yet supported in
azurerm is the default, stable choice. azapi is a powerful tool to access recent or unsupported ARM features, but it requires additional care. Use them together strategically to keep Terraform aligned with Azure’s pace of innovation without sacrificing reliability.

Links and references
- azurerm provider (Terraform Registry)
- azapi provider (Terraform Registry)
- Azure Resource Manager REST API reference
- Terraform documentation