Author: jbmurphy
-
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…
-

Using Azure Traffic Manager with IP White-listed resources
The question was, how can you use Azure Traffic Manager if the destinations are restricted with IP white lists?This is the only way I could find: There is a blob that contains the source IPs of the probes. Here is the file, And here is the reference This list would need to be queried often…
-
PowerShell to move a VM to a new Log Analytics WorkSpace
This code uninstalls the Microsoft Monitoring agent and re-installs it to a new WorkSpace. Nothing special, just thought I would put it here. Mayby it will help someone?
-
Use the REST API to create a new Project in Azure DevOps
As the title says, I wanted to create a new project in VSTS / Azure DevOps, whatever you want to call it. Here is the code to do that. You need a Personal Access Token to authenticate with. Hope that helps someone?
