One of the summer night “lab sessions” produced this one – I was testing something and was in need to add a couple of new DNS records in my Cloudflare account. Of course, “the normal way” would be to login to the beautiful web-page doing just that, but I wanted to do it differently. Of course – with PowerShell. And of course – with the help of my vibe coding AI companion, ChatGPT. 🙂
So, the idea was born – let’s vibe produce the PowerShell script which will check and add some (A, CNAME and TXT) records to my Cloudflare-hosted domain, backup the state before and after for… purposes, and report to me what was done in a nice, readable way.
The same thing I could have done via the web-page even faster, but… 🤷♂️
The result is script called Add-CfDNSRecord.ps1, which is available on my GitHub, and does just that! 🙂
And for the script to work, you will need the API token, which you can create as following:
- Login to your account at https://dash.cloudflare.com/
- Go to Profile (top right “user” menu)
- Go to API Tokens (left menu)
- Create Token
- You can use the Edit zone DNS template
- Configure settings of your token (constrained as possible in terms of zone, duration, etc.)
- Use this token with the script
This can be improved, but it does the job (for me).
Use at your own risk (like with everything you find online)!
Cheers!





















