Skip to main content

Cloudflare

Manage Cloudflare DNS records, WAF custom rules and URL redirect rules from Bicep.

Community Maintained

Version0.1.58
Artifactbr:cloudflarebicep.azurecr.io/cloudflare:0.1.58
Sourcegithub.com/riosengineer/cloudflare-bicep-deploy
Publisherriosengineer
CategoryNetworking

Installation

Register the extension in bicepconfig.json:

{
"experimentalFeaturesEnabled": {
"localDeploy": true,
"ociEnabled": true
},
"implicitExtensions": [],
"extensions": {
"Cloudflare": "br:cloudflarebicep.azurecr.io/cloudflare:0.1.58"
}
}

Then reference it from your Bicep file:

extension Cloudflare

Configuration

Configuration is supplied using extension Cloudflare with { ... }.

PropertyTypeAttributesDescription
apiKeystringCloudflare API Key (legacy)
apiTokenstringCloudflare API Token (recommended)
baseUrlstringBase URL for Cloudflare API
emailstringCloudflare account email (required with API Key)

Authentication

Set CLOUDFLARE_API_TOKEN to a Cloudflare API token before running the deployment. Give the token only the permissions needed by the resources in the template, such as Zone DNS Edit for DNS records or Zone Rulesets Edit for WAF custom rules.

Example

Create a DNS record in a Cloudflare zone:

targetScope = 'local'

extension Cloudflare

param zoneId string
param domainName string

resource record 'DnsRecord' = {
name: 'www'
zoneName: domainName
zoneId: zoneId
type: 'A'
content: '192.0.2.1'
ttl: 300
proxied: true
}

Notes

  • Security rules use Cloudflare WAF custom rules through the Rulesets API.
  • Redirect rules use Page Rules and are subject to the limits of the Cloudflare plan associated with the zone.
  • This extension is experimental and its publisher advises against production use.

Samples

3 example Bicep files are available under Samples.

Resource types

This extension exposes 4 resource types, documented under Reference.

Reference generated from cloudflarebicep.azurecr.io/cloudflare:0.1.58 on 2026-08-24.