AzSentinel – Version 0.6.5

Good news guys! A new version of AzSentinel is available in PowerShell Gallery with bunch of bugfixes and new features.

Before we jump to all the good stuff, please let me thank everyone for their great feedback, support and mostly patience :p I know this version took really long and I received lots of messages. So sorry for that. The reason that it took longer is because I started my own company a couple of months ago and that kept me quite busy. As I promised I will keep maintaining this module until the Microsoft official PowerShell module is released. With that said, below you’ll find a list of changes in this new version.

1. (Breaking) changes

In this version I have decided to drop the compare functionality. This means that from now on if an alert exists, you don’t get the popup message to confirm the new changes. Why, you ask. Well with the new Incident settings and Alert grouping, the Alert Class contained child objects and I had a really hard time to fix this in the compare functionality. So I asked around and understood that people don’t use this option that much, because most of the time deployments are done through Pipeline. So I still use it in some of the functions. Like to decide if a playbooks is assigned and if we need to remove it for example. Maybe we can bring this back in the next version. Let me know what you think about this decision and if you have any tips.

Another one is the output of “Import-AzSentinelAlertRule”. In the current version it’s returned with Write-Output and this has different result than the return function. Also, instead of writing each rule output one by one, I collect it in a temp variable and return at once. This also speeds up the loop process. So how do you know if your rule was created successful or not? Well I have added a new property value named “status” and it returns 3 values:
Created: if a rule doesn’t exist and is created;
Ok: if a rule exists and gets updated;
Failed: if there was an issue, with this one you will also get an error output at the beginning of the output (so scroll up).

In the upcoming version I will try to implement more performance optimization. If you have feedback please create an issue on GitHub or get in touch with me.

2. Support for Incident settings

Also new in this version is support for Incidnet settings. You can use CreateIncidnet property in the JSON/YAML template or use the -CreateIncidnet switch when using New-AzSentinelAlertRule command. If you don’t configure this then the Microsoft default settings will be applied and your existing rules (JSON) are backwards compatible.

3. Alert grouping

Also, this new version contains support for Alert grouping. You can configure this by adding the following properties to your JSON/YAML template for each rule or by using the New-AzSentinelAlertRule with the same properties. If you don’t configure this then the Microsoft default settings will be applied and your existing rules are backwards compatible.

or by using the following switches:

4. Alert aggregation (private preview)

This is a new feature that Ofer has talked about in his latest presentation and in my opinion one of the must have features in Azure Sentinel Alert creation process. This option gives you the possibility to treat each event as a separate alert in Sentinel. This way instead of having one alert rule attached to your incident which contains 12 events, you can e.g. have 12 separate alerts assigned to one incident or 12 incidents each having one or more alerts. You can now enable this feature using -AggregationKind “AlertPerRow” in the New-AzSentinelAlertRule function or by using “aggregationKind”: “string” property in your template.


You have the following options:
– SingleAlert (default value)
– AlertPerRow

5. Rename-AzSentinelAlertRule

Also, you can use the Rename-AzSentinelAlertRule to rename your existing Rules.

6. Set-AzSentinel updated

In this version the Set-AzSentinel command will automatically enable the required Resource Providers if those are not enabled in your Subscription.

  1. Microsoft.SecurityInsights
  2. Microsoft.OperationsManagement

7. Get-AzSentinelPlayBook updated

And finally, there were some issues with the number of playbooks returned. Shout-out to @stehod for solving this issue.

AzSentinel – Version 0.6.2

New version of AzSentinel is available in PowerShell Gallery with bunch of bugfixes and some new features. See below a list of the changes in this version.

1. Configure Action for Alert Rules

From this version it’s possible to configure “Actions” for the Alert Rules through New-AzSentinelAlertRule by using the -playbookName switch. Or by configuring JSON “PlaybookName” property for each Alert rule. You only need to provide the logic APP name that you want to assign to your Alert rule. The function will automatically search the Logic App in your Subscription, the logic App is also tested to see if it’s compatible for Azure Sentinel!
This option is backwards compatible, if you don’t have the “PlaybookName” covered in your JSON template no changes will be applied. Thanks sbroosnokia for the feedback!
Below the new JSON layout:

To make this feature available the following new functions are added to AzSentinel:

Get-AzSentinelAlertRuleActionUse this function to see if a Alert rule has Action configured
New-AzSentinelAlertRuleActionConfigure Action for an existing Alert rule
Remove-AzSentinelAlertRuleActionRemove configured Action

2. Update Incident

In this version there is also an Update-AzSentinelIncident function available that you can use to update existing incidents. Not all the properties are currently available in Update function, but in feature version I will extend the possibilities. See below a list of current possibilities:


Close Incident with argument:

Change incident status to inProgress:

Add label to existing labels:

3. Bugfixes

Below list of hotfixes:

titleurlthanks to:
Time Format conflict #38
Issue using Import-AzSentinelAlertRule #27

Azure Sentinel PowerShell Module

“Azure Sentinel is a cloud-native SIEM that provides intelligent security analytics for your entire enterprise at cloud scale. Get limitless cloud speed and scale to help focus on what really matters. Easily collect data from all your cloud or on-premises assets, Office 365, Azure resources, and other clouds. Effectively detect threats with built-in machine learning from Microsoft’s security analytics experts. Automate threat response, using built-in orchestration and automation playbooks.” read more

Rules in Azure Sentinel create the basic logic on which Incidents get created. Currently the only way to add, change or delete rules is through the Azure portal. As we’re running a cloud Security Operations Center at Wortell with many customers connected, doing this manually is no option for us.

PowerShell Module

At the moment there is no documented API, ARM or PowerShell module to configure Azure Sentinel. After doing some research we were able to find the API’s that are currently being used by the Azure Portal and based on that we’ve written a PowerShell module to manage Azure Sentinel through PowerShell. Continue reading Azure Sentinel PowerShell Module

Move Azure VM with Managed Disk to another Resource Group

At the moment of writing this blog it’s unfortunately not possible to move an Azure VM with Managed disk to another Resource Group or to another Description. However, Microsoft says on the Azure Portal that this will be possible in the near feature. For the time being, I have chosen to write a small PowerShell script that will do the move fully automated for you. At the moment the only way to move an Azure VM with Managed Disk to another resource group is redeploying the VM. To achieve this you need to perform the following steps (some from the portal and some from PowerShell) manually:

  1. Shutdown VM
  2. Collect the required information like Networking, VM size, Storage etc.
  3. Create a Snapshot
  4. Create or use an existing Azure Storage Account to copy the Snapshot to
  5. Remove the VM
  6. Create a new Azure VM in the new Resource Group with the collected information and Snapshot disk from the Azure Blob
  7. The Azure VM will start automatically, check if the VM functions as it should and remove the Snapshot and Azure Storage Account.

As you can see there are about 7 steps needed to move an Azure VM with a Managed Disk. The script that I have written will do all the steps automatically with only 3 variables that you need to define while running the script. Continue reading Move Azure VM with Managed Disk to another Resource Group

Import thumbnailphoto in AD from jpg

The script below will import Jpg file as a thumbnail photo in Active Directory

$username = "p01001"
$jpgfile = "C:\PICTURE.jpg"

$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = $dom.GetDirectoryEntry()
$search = [System.DirectoryServices.DirectorySearcher]$root
$search.Filter = "(&(objectclass=user)(objectcategory=person)(samAccountName=$username))"
$result = $search.FindOne()
if ($result -ne $null) {
 $user = $result.GetDirectoryEntry()
 [byte[]]$jpg = Get-Content $jpgfile -encoding byte
 $user.put("thumbnailPhoto",  $jpg )
 Write-Host $user.displayname "updated"
}celse {
  Write-Host $user "Does not exist"