> For the complete documentation index, see [llms.txt](https://docs.mspp.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mspp.io/ninjaone-auto-documentation/cloudflare.md).

# CloudFlare

This script will generate a NinjaOne Document template and NinjaOne documents for every domain contained in CloudFlare

<figure><img src="/files/z1n4qxQbiepm4CTFPE2s" alt=""><figcaption></figcaption></figure>

## **Requirements**

Make sure the [Getting Started](/ninjaone-auto-documentation/getting-started.md) guide has been followed

### **NinjaOne Products**

Core RMM

NinjaOne Documentation

### **Recommended Schedule**

Once per day

### **Role Setting Custom Fields**

<table data-full-width="true"><thead><tr><th>Display Name</th><th width="254.8">Name</th><th>Type</th><th>Permissions</th><th>Description</th></tr></thead><tbody><tr><td>CloudFlare API Token</td><td>cloudflareToken</td><td>Secure</td><td><p>Technician: Editable<br>Automations: Read/Write</p><p>API: None</p></td><td>Your CloudFlare API Token</td></tr></tbody></table>

### **Global Custom Fields**

None

## Setup

To run this script create a new CloudFlare API Token with the following permissions:

* All accounts - Account Settings:Read
* All zones - Origin Rules:Read, Zone Settings:Read, Zone:Read, DNS:Read, SSL and Certificates:Read, Logs:Read, Page Rules:Read, Firewall Services:Read, Analytics:Read

Once this is created edit the CloudFlare API Token field on your script running device to add in this key.

## Matching

Domains are matched using NinjaOne Cloud Monitors. In order to match a domain to an Organization configure a cloud monitor that points to that domain as the target of the Cloud Monitor.

Alternatively if you do not wish to create a Cloud Monitor, you can run the script once and then create a blank Cloudflare document under the correct organization with a name that matches the domain in CloudFlare.

## The Script

{% @github-files/github-code-block url="<https://github.com/lwhitelock/NinjaOneAutomation/blob/main/DocumentationScripts/NinjaOne-CloudFlare.ps1>" %}
