Reading Time: 2 minutes

Recently the Azure Security Center (ASC) team have released a preview of a new PowerShell module they have been working on, AzureRM.Security. This module is designed to allow you to manage the ASC automatically. You can view the module on the PowerShell gallery here. Below I will show you how to install the module and run a few commands to show you want it does.

First look

Requirements

To be able to use this module you will need to make sure you meet the following requirements:

  • PowerShellGet version 1.6.7 or later
  • AzureRM.Profile version 5.5.0 or later.

The Installation

Open PowerShell in admin mode and type the following to Update PowerShellGet

Install-Module PowerShellGet –Repository PSGallery –Force

Now enter this command to install the correct version of AzureRM.Profile.

Install-Module -name AzureRM.Profile -requiredversion 5.5.0

If prompted press Y to continue the installation.

Now you can actually install the new module by using:

Install-Module -Name AzureRM.Security -AllowPrerelease

If prompted press Y to continue the installation.

You can now close the PowerShell window.

Import the Module

Open a normal PowerShell window and type the following to load the correct version of  AzureRM.Profile. (The newest one is not currently supported.)

Import-Module AzureRM.Profile -RequiredVersion 5.5.0

Now you can import the AzureRM.Security module.

Import-Module AzureRM.Security

Use the Module

Now we can actually use the module. First, you will need to login to your Azure account. You will need to use a user that has access to the ASC.

In the PowerShell window type the following to connect to Azure.

Connect-AzureRmAccount

Lets test a command.

Get-AzureRmSecurityAlert

Hmm, this one seems broken. Well it is in preview still. Lets try another.

Get-AzureRmSecurityPricing

This one seems to work.

To get a list of the cmdlets use the following command.

Get-Command -Module AzureRM.Security

I am looking forward to seeing what else I can do with this new PowerShell module. If you do anything cool let me know using the usual methods.


Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *