Deleting old web app logs using Azure Web Jobs and PowerShell
When you're Azure App Service writes a lot of logs, these logs can quickly pile up and even hit your "File system storage" quota limits. This was something I personally didn't pay attention to for quite some time and was surprised to find multiple gigabytes of logs sitting in my app service. To solve this issue, you can use a PowerShell script and a time triggered Azure Web Job.
Bulk add IP Access Restrictions to Azure App Service using Az PowerShell
Azure App Services are publicly accessible via Azure's public DNS in the format of "[NAME].azurewebsites.net", but there are many reasons for not wanting it to be accessible via the DNS. This script uses the Az PowerShell module to bulk add IP Ranges into the Access Restriction feature in App Service.
Bulk add Cloudflare's IPs to Azure App Service Access Restrictions using Az PowerShell
Azure App Services are publicly accessible via Azure's public DNS, but when using Cloudflare you should lock this down to only allow Cloudflare to reach your service. This script will add all Cloudflare's IP ranges to your app service Access Restriction.
Bulk add Application Insights Availability Test IPs to Azure App Service Access Restrictions using Az PowerShell
Azure App Services are publicly accessible via Azure's public DNS, but using Access Restrictions you can lock this down. To ensure your App Insight Availability Tests still work, you can use this PowerShell script to bulk insert all the IP ranges.
Clearing Cloudflare cache using PowerShell in Azure DevOps Pipelines
Learn how to purge Cloudflare's cache as part of your Continuous Deployment. This post will walk you through creating a PowerShell task that interacts with Cloudflare's API to clear the cache. This task will run as part of an Azure DevOps Pipelines.
PowerShell Snippet: Clearing Cloudflare Cache with Cloudflare's API
Cloudflare provides a GUI to purge cache, but every action you can perform using the GUI, you can also do with Cloudflare's API. You could use the API to auto purge the cache whenever you update content in your CMS of choice, or purge the cache as part of your Continuous Delivery pipeline. Using PowerShell we'll interact with Cloudflare's API and purge their cache.
PowerShell Snippet: Crawling a sitemap
Here's a PowerShell function that you can use to validate that all pages in your sitemap return a HTTP Status code 200. You can also use it to warm up your website, or ensure your website caching is warm after a cold boot. I personally use it as part of my Continuous Delivery pipeline to warm up my site and Cloudflare's cache.