Author Archives: Chris

Check Azure WebApps have Backup Configured

Azure WebApps (depending on tier) come with an optional native backup service. This quick PowerShell snippet looks at all the WebApps in the current subscription and reports back on whether Backup has been set up. This should be helpful for spotting where a configuration has been missed.

Use Set-AzContext to set the subscription in advance, and to restrict to an individual Resource Group use the –ResourceGroupName on the Get-WebApp cmdlet in the first line.

foreach($WebApp in Get-AzWebApp ){
  if (Get-AzWebAppBackupConfiguration `
      -ResourceGroupName $WebApp.ResourceGroup `
      -Name $WebApp.Name `
      -ErrorAction SilentlyContinue) {
  $WebApp.Name+" Backup Configured"
  } else {
  if( (Get-Error -Last 1).Exception.Response.Content `
      -like "*Backup configuration not found for site*")
    {$WebApp.Name+" Backup Not Configured"}

Using New-AzureFirewallRule with multiple ports or IP ranges

When creating an Azure Firewall rule with multiple ports or IP ranges using the PowerShell “New-AzureFirewallRule” cmdlet, you may get an error like this:

Invalid IP address value or range or Service Tag,
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: AzureFirewallRuleInvalidIpAddressOrRangeFormat


Invalid port value or range. User ports must be in [1, 65535]
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: AzureFirewallRuleInvalidPortOrRangeFormat

The incorrect code causing these messages refers to the Source Address or Destination Port as a comma-delimited string as you would use in the Azure Portal, as shown here:

#Incorrect Code
$netRule = New-AzFirewallNetworkRule `
     -Name "FirewallRule1" `
     -Description "Rule for HTTP,SMB traffic" `
     -Protocol "TCP" `
     -SourceAddress "," `
     -DestinationAddress "" `
     -DestinationPort "139,445,80"

However, the cmdlet wants an array of strings to be passed here rather than a comma-delimited string value, so (“″,””) rather than “,”. The correct version of the above code snippet is as follows:

#Corrected Code
$netRule = New-AzFirewallNetworkRule `
     -Name "FirewallRule1" `
     -Description "Rule for HTTP,SMB traffic " `
     -Protocol "TCP" `
     -SourceAddress ("","") `
     -DestinationAddress "" `
     -DestinationPort ("139","445","80")

Checking Hybrid Benefits in Azure with PowerShell

When using Windows-based Virtual Machines on Microsoft Azure, there’s an option to use “Azure Hybrid Benefit” to re-use existing Windows licenses you own on-premises for workloads now running in the public cloud.


If you don’t select this option then your Azure bill will include the cost of a new Windows license for that virtual machine, so it’s important to ensure it is used where you are entitled to do so. If you have a site license, or campus agreement, you may find that you are allowed Hybrid Benefit on all your workloads in Azure.

This PowerShell snippet will list all the Windows Virtual machines (in the current subscription- use Set-AzContext to change that) which are not making use of the Hybrid Benefits- giving you a quick list of VMs to check the settings on.

Get-AzVM | Where-Object {$_.OSProfile.WindowsConfiguration -and !($_.LicenseType)}

Virtual vs In-person Conferences

In the current pandemic situation (April 2020) a lot of events, both small and large, have had to close their doors and move from in-person to virtual on-line environments. There’s been a lot of chatter about this on the interwebs, and how some people favour the way of conferencing we have been forced into adopting.

From my perspective I find it hard to see how online meetings can match up to the in-person show. The section of the event where you’re sat quietly listening to a speaker, raising your hand with a question, or asking at the end, is similar between the two. Viewing from home you have a more comfortable chair but, on the flip side you must buy your own drinks and snacks. However, you are just watching an online webinar and the moment the session ends, you step out of that breakout back into your home life.

Distance-learning like this is great, but it’s just one component of what makes the traditional tech conference such a worthwhile experience. It’s that time when you’re not sat down listening to a presentation or trying out a lab that can really make the difference.

Discussions happen with random people on the show floor, in a queue, at the bar in the evenings, or even at the airports. The social component, even for an introvert, should not be underestimated. I’ve now got some great friends, gained unexpected knowledge, and understood things from different viewpoints thanks to tech conferences. It’s also one of the few ways of breaking out of the “bubble” of IT in my organisation and seeing what people do in similar functions in the wider world.

IMG_20200128_145028331 (2)

Even the big events I’ve attended- VMworld, Cisco Live, Microsoft TechEd – I’ve gone into knowing few, or even zero, people at the event but always come away with new contacts, experiences, and friends. I don’t get any of that from the breakout sessions, it’s all from those bits in-between.

Getting out of the office (or these days the home-office) is an important method of separation and difficult to replicate without travelling to a conference (even if it’s just down the road). Without that separation it’s hard to avoid being (as) distracted by the day to day and able to concentrate on learning.

I’d love to be proven wrong. If someone can figure out how to answer this puzzle of doing the bits between and after the sessions well in an online environment I’d be overjoyed, but I’m still waiting for that to happen. Perhaps the London VMUG next week might surprise me.

Going for a run? Share your progress with Google Maps

I’ve done a number of long runs in the past few years, both at Ultramarathon events and in training beforehand. In the online forums for these events people often talk about whether they should hire GPS trackers but I’ve been using the free Location Sharing feature on Google Maps instead as I’m already carrying my phone.

Why Share?

IMG-20190713-WA0012-cropSharing my location with family and friends is a useful way for them to keep track of me. For example if I’m getting collected at the finish, or if a friend who is also running can see I’m just behind them they might slow down for a chat.

In the training runs in particular tracking is also a good safety feature. If I’m not back home when expected then my family can quickly check to see if I’ve stopped (possibly injured) somewhere or if I’m just taking a scenic detour past the beer garden of the Coach and Horses.

Does the battery last?

I’ve found that on my Android phones (currently a Moto G6) I’ve not had any really noticeable impact on battery life when using Location Sharing. If I’m on one of my longer runs (over 6/7 hours) then I’ve usually got a portable USB battery stashed in my running bag with the first aid kit and Jelly Tots anyway. I find that using the camera and screen is more likely to impact the battery life.

How to set it up

This is how I set up Google Maps Location Sharing on my phone. Your experience may differ, but hopefully not by much.

1. Open Google Maps on your phone and tap on your picture on the top right hand corner


2. On the menu, choose “Location sharing”


3. The next screen will show anyone you are already sharing with, Tap the “Add people” button in the top right.


4. You can then set how long you want to share your location for- here it often makes sense to say “Until you turn it off”- if you forget to then Google will email you a reminder periodically over the coming days. Finally either pick contacts to share your location with or choose to share a weblink by email/ WhatsApp etc.


And that’s it. Lace your trainers up and off you go. Just remember to take your phone with you!

Footnote- it’s worth remembering that as with the GPS trackers your position will only be updated when you have data reception The Maps app will however show how long ago the last reading was taken so if you are disappearing off into the wild where there’s no cell coverage your friends might see a “20 minutes ago” note below your icon.