Author: jbmurphy
-

PowerShell: Remove old Az modules
I recently ran a Get-Modules -ListAvaiable and I saw a lot of older versions: I wanted to remove all versions except the most recent. Here is my script: Hope that helps someone.
-

AKS: you update-credentials and can’t pull from your ACR?
Ran into this one the other day. Suspect it may be an issue for some people as their Service Principle secrets are going to expire soon (default is 1 year). I used the following method below to build an AKS cluster: Standard Stuff. The trick is, when you need to update you SP credentials, how…
-
Using Azure Resource Graph for your inventory script
In the past I have always run Get-AzureRmResourceGroup, and then looped through all the resources groups and the VMs inside of them. This can be slow. So I put together this script to leverage Azure Resource Graph for your inventory. I hope this helps some one: This pulls back everything and then you can pull…
-
Add a Document to CosmosDB via the REST API using PowerShell
There are a lot of examples out there on how to POST a document to Cosmos DB, but they weren’t working for me. I kept getting a 400 Bad Request. After far to long, I finally got it to work. I need the “x-ms-documentdb-partitionkey” header to make it work. Code for anyone who needs it…
-
Connecting to the Azure REST API from an Azure Automation RunBook
I was looking for data that I couldn’t find in a PowerShell command, so I needed an access token to run a query against an Azure API. I was stuck with the basic problem of how do I query the Azure REST endpoints from a RunBook. In my last post, I just learned that you…
-
Azure Runbook to enable Auto-Shutdown for New VMs
I have an azure lab subscription (as do you, I am sure). In this lab, I am always provisioning and deleting and scaling VMs. In order to keep my costs down, I want to enable the AutoShutdown feature on all new VMs. I can do that easily with an ARM template. But for machines that…
-

vim: How to stop the tab annoyingness when you paste
This is a NoteToSelf. Often I paste into VI/VIM, and the tabs go crazy and fly across the screen, leaving the text starting in the middle of the line. Then next line is even further! I can never remember how fix the issue. To fix: :set paste
-
Moving to the new (and future) Azure PowerShell Module : Az
It looks like we need to move to the new Az module. It is not required, but future functionality will not be added to AzureRM, so I decided to make the switch. Here is how I went about it. First, to enable backwards compatibility, you need to add this command to your profile : “Enable-AzureRmAlias”…
-
Code to query Azure Load Balancer Metrics to verify Availability (VipAvailability )
This one was fun to put together. I wanted to write code to query the status of an Azure Load Balancer. I couldn’t find much out there. This code query’s the Azure Load Balancer’s Metrics for VipAvailability – through the REST API. If it returns 100 then are good to go. Anyting else, then there may…
-
Note to self: cURL with data-urlencode for GET/QuerySting values
I know I would loose this if I didn’t blog it. With cURL, you can use “–data-urlencode” with query string params and a GET if you include the “-G” parameter. Of course you still have to escape things out, I just found it easer to add all the QueryString params separately. All the examples I…
