Azure API Management: PowerShell Reporting & Cache Hit Ratio

I was recently working with a customer who needed to view the cache hit ratio of an Azure API Management instance. Currently the UI dashboard doesn’t report this information, however there is a lovely API which you can call.

As we needed something up and running fast PowerShell seemed like the perfect way to quickly retrieve the JSON and convert it into an object then format it nicely. The script also stores the results to disk so we have a copy to hand.


Here is the resulting little script.

To use this on your instance replace the URL and SharedSigniture with your own. You can get these from the administration portal for APIM under the security tab.

For full details on what you can do with the rest API head here for the docs.

Tagged , ,

Detecting Taps on Microsoft Band with RX and C#

This is a follow on to my original post on using RX with the Band to stream sensor information.

Using the RX streams and some maths to detect (roughly) when a user taps on the band. This allows you to send a notification to the band, for example, saying “I think your home, tap band to turn on your heating”.

Below is the result, I can really easily “await” tap or shake events! You can grab the code here and see how it all works below.

var stream = await band.GetShakeOrTapStream();

await stream.FirstAsync().ToTask();

  Continue reading

Tagged , ,

Powershell Invoke-WebRequest with a cookie

Nice and quick post here, mainly so I remember when I need it again, this is a quick sample which shows how to make a web call from PowerShell including a cookie.

Most old methods will suggest using the WebClient object but the new (well newer than the WebClient) Invoke-WebRequest commandlet is a much nicer, in my opinion.

It takes a bit of fooling around to get this up and running so wanted to share.

Tagged ,

Get every new post delivered to your Inbox.

Join 323 other followers