Blog - PowerShell

Swimburger
Umbraco, Azure, and Linux logo

Deploying Umbraco 9 to Azure App Service for Linux

- Umbraco
Learn how to create the Azure infrastructure using the Azure CLI to host an Umbraco 9 website using Azure SQL and Azure App Service for Linux, and how to deploy your Umbraco 9 site.
An illustration of a lock and a key. The key handle is in the shape of the Twilio logo.

Better Authentication with Twilio API Keys

- .NET
API Keys are now the preferred way to authenticate with Twilio's API. You can create as many API Keys as you need and remove them if they are compromised or no longer used.
PowerShell logo and Google Chrome logo

Download the right ChromeDriver version & keep it up to date on Windows/Linux/macOS using PowerShell

- PowerShell
Chrome frequently updates automatically causing ChromeDriver versions to mismatch. Using PowerShell you can download the correct version of the ChromeDriver and keep it up-to-date.
PowerShell and Azure Application Insights logo

Run Custom Availability Tests using PowerShell and Azure Application Insights, even on-premises

- Azure
The built-in availability tests in Azure Application Insights are great but very basic. You can create your own custom availability test. Learn how to create a custom availability test using PowerShell and Application Insight's .NET SDK.
Screenshot of HTTP Request in PowerShell

Video: Copy HTTP Requests from Chrome/Edge DevTools to PowerShell/cURL/Fetch

- Web
You can copy the recorded HTTP requests the from Chrome and Edge DevTools to PowerShell/cURL/Fetch. This allows you to quickly replay HTTP requests from the console/command line saving saving you time!
PowerShell logo

ConvertFrom-SecureString : A parameter cannot be found that matches parameter name 'AsPlainText'

- PowerShell
If you're using older versions of PowerShell, you do not have the 'AsPlainText' flag available to you. You're not out of luck though, you can quickly create your own function which will give you the same result.
PowerShell logo

PowerShell Script: Scan documentation for broken links

- PowerShell
A lot of documentation will link to other locations on the web using URL's. Unfortunately, many URL's change over time. Additionally, it's easy to make typos or fat finger resulting in incorrect URL's. Here's a small PowerShell script you can run on your documentation repositories and will tell you which URL's are not resolving in a proper redirect or HTTP StatusCode 200
Screenshot of HTTP Request in PowerShell

Copy HTTP Requests from Chrome/Edge DevTools to PowerShell/cURL/Fetch

- Web
You can copy the recorded HTTP requests the from Chrome and Edge DevTools to PowerShell/cURL/Fetch. This allows you to quickly replay HTTP requests from the console/command line saving saving you time!
CRM and PowerShell logo

Use PowerShell to communicate with Dynamics CRM using the .NET XRM SDK

- Dynamics
If you've developed client applications or plugins for Dynamics CRM before, you are familiar with the CRM/XRM DLL's. You may have gotten those DLL's from the CRM installation, the SDK zip, or the NuGet package. Another way to interact with the CRM DLL's is through PowerShell. PowerShell is built upon .NET meaning you can call exactly the same CRM libraries from PowerShell as from .NET applications.
CRM and PowerShell logo

PowerShell snippet: Get optionset value/labels from Dynamics CRM Entity/Attribute

- Dynamics
Instead of having to use the CRM interface to copy all the labels and values manually, you can save yourself a lot of time using this PowerShell script. Using the following script file named "GetOptionSet.ps1", you can list all the value/label pairs for a given Entity + OptionSet-Attribute:
PowerShell and Azure WebJobs Logo running a shredder, shredding logs

Deleting old web app logs using Azure Web Jobs and PowerShell

- Azure
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.
Azure Logo holding a stop sign and PowerShell logo

Bulk add IP Access Restrictions to Azure App Service using Az PowerShell

- Azure
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.
Azure logo holding stop sign, PowerShell logo, and Cloudflare logo

Bulk add Cloudflare's IPs to Azure App Service Access Restrictions using Az PowerShell

- Azure
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.
Azure logo holding stop sign and PowerShell logo

Bulk add Application Insights Availability Test IPs to Azure App Service Access Restrictions using Az PowerShell

- Azure
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.
Azure DevOps Pipelines clearing Cloudflare Cache with broom

Clearing Cloudflare cache using PowerShell in Azure DevOps Pipelines

- Azure
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 Logo

PowerShell Snippet: Clearing Cloudflare Cache with Cloudflare's API

- PowerShell
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 logo

PowerShell Snippet: Crawling a sitemap

- PowerShell
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.