Git Product home page Git Product logo

azureassess's Introduction

Azure Assess Module

PSGallery Version PSGallery Downloads PSGallery Platform

Welcome to the Azure Assess Module! This powerful tool is designed to enhance your Azure security assessment process. With minimal access permissions, you can gain a comprehensive understanding of your Azure resources and their security configurations. Ideal for diverse operations teams and tech-savvy management, this module is easy to use and provides valuable insights. Give it a try and see how it can transform your Azure security assessment process!

Please note that to collect the data, you'll need an account with access to the Azure resources you want to report on. Once the data is collected, you can review and share the information with others who may not have such access, such as larger operational teams or interested management personnel.

The Azure Assess Module extracts information about Azure resources at various container scopes, including Management Groups, Subscriptions, and Resource Groups. The extracted information is stored in CSV files, providing a "flattened" view of the linked resources.

In addition to resource data, the module collects information about privileged role assignments on resources at the specified scope. It also gathers information about related principals, including users, service principals, and groups, taking into account group memberships and entity ownerships.

Furthermore, the module gathers information about Defender for Cloud coverage and related recommendations.

The module comes with a PowerBI template for visualizing the collected information.

The goal of this project is to provide portable information on Azure Security. To achieve this, we've chosen to collect data via PowerShell and represent it via PowerBI. This approach ensures portability and reduces the need to provide additional access into Azure.

Data Collection

⚠️ You'll need the following roles to execute the script:

  • Permission to read the resources you want to assess: tipically the "Reader" role on the subscriptions or resource groups
  • Permission to read the data on the identities you want to collect included the permission to read reports as the last signing requires it: "Global Reader".
  • Last Sign-ins to Azure are collected trough log analytics: read on the log analytics recivieng Sign-in logs, Service principal sign-in logs and managed identities sign-in logs is needed both for interactive and non interactive.

⚠️ The script currently doesn't support nested management groups (i.e. collecting from the root management group). To circumvent the limitation you can provide multiple management group names while collecting data. The module expects that management groups to have subscriptions.

To collect data you can follow the bellow script

# install the powershell module
PS> Install-Module -Name AzureAssess
# connect to Azure - leverages Connect-AzAccount
PS> Connect-AzureAssess
# Collect information about management groups
PS> Get-AzureAssessResources -ManagementGroupNames <management groups>
# *Or* collect information about a subscription
PS> Get-AzureAssessResources -SubscriptionId <subscription id>
# *Or* collect information about a resource group
PS> Get-AzureAssessResources -SubscriptionId <subscription id> -ResourceGroupName <resource group name>
# Get information about role assignments
PS> Resolve-AzureAssessPrivilegedIdentities

This will give you the set of CSV that can be loaded into PowerBI template ./assets/AzureResources.pbit

Power BI Example

The image below depicts the result in Power BI:

PowerBI Sample

Information on Targeted Resources

For Azure resources, the module primarily collects the following information:

  • Id: The Azure ID of the resource
  • ResourceGroupId: The ID of the resource group hosting the resource
  • Type: The type of the resource
  • Name: The name of the resource
  • Link: The link to view the resource in Azure
  • Location: The location of the resource
  • PublicNetworkAccess: Whether network access is enabled or disabled for the resource
  • HasFirewallRules: Whether there are specific firewall rules related to the resource
  • HasPrivateEndpoint: Whether there is a private endpoint associated with the resource

The resources currently supported are:

  • App Service Plans
  • Web Apps
  • SQL Servers
  • Key Vaults
  • Storage Accounts
  • Virtual Machines
  • Private Endpoints

Azure App Services

For App services, the following additional information is gathered:

  • AppServiceInbound: Public if the app service plan has a public address, or Internal for private addresses

Azure Web App

For Web apps, the following additional information is gathered:

  • State: Status of the Web App (running or stopped)
  • DefaultHostName: The default hostname for the webapp
  • HttpsOnly: Whether TLS is mandated
  • MinTlsVersion: Minimum version of TLS
  • FtpsState: Whether FTP(S) is enabled and FTPS is required to upload code
  • AppServiceEnvironmentInbound: Whether the leveraged app service environment, if used, is on a public IP or a private IP.

SQL Server

For SQL servers, the following additional information is gathered:

  • FullyQualifiedDomainName: The FQDN of the server
  • MinimalTlsVersion: Minimum version of TLS
  • AdministratorType: Type of administrator for the SQL (Active Directory or local)
  • EntraOnlyAuth: Whether the SQL server only allows SQL authentication

Key Vault

For Key Vaults, the following additional information is gathered:

  • VaultUri: URI of the vault
  • EnableSoftDelete: Whether soft delete is enabled
  • EnablePurgeProtection: Whether purge protection is enabled

VM

For Virtual Machines, firewall rules and public access are evaluated specifically. Public Access is considered disabled if the VM doesn't have a NIC with a public IP. Firewall Rules are evaluated against the corresponding NSG rules (disallow all incoming present and no rules allowing all). The additional information gathered includes:

  • HasOpenSSHorRDP: Whether SSH (tcp 22) or RDP (tcp 3389) ports are allowed
  • VmSize: Size of the VM
  • PublicIp: The public IP of the VM, if present

Private Endpoints

Private endpoints are collected to join on the above resources.

Security Recommendations

The script also collects the Defender for Cloud recommendations in this CSV.

Subscriptions

The list of subscriptions seen during collection. Additional information on subscriptions includes:

  • What Defender for Cloud protections are enabled on the subscriptions
  • Per Defender for Cloud protections, are there any resources protected present

Management groups

Only basic infromations on management groups are collected.

Role Assignments

For the collected resource groups the role assignement are collected including the parent subscription and management groups and child resources.

User, Groups and ServicePrincipals

All related Users, Groups and ServicePrincipals are collected. Membership as well as ownerships are extended.

azureassess's People

Contributors

bartbilliet avatar cblomart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

azureassess's Issues

Error message: A parameter cannot be found that matches parameter name 'CaseInsensitive' when importing subscription

Describe the Bug
i ran an initial import last week on a large environment and got the below error.
Today i tried it on a smaller environment and selected only a specific subscription, unfortunately the same issue cam.

To Reproduce
Steps to reproduce the behavior:

  1. Run Connect-AzureAssess
  2. Run Get-AzureAssessResources -SubscriptionId <subid>

Expected Behavior
Either an understandable error message of continue the processing (i think)

Screenshots
image

Environment (please complete the following information):

  • OS: [e.g. Windows 11]
  • PowerShell version [e.g. 7.3.10]
  • Module Version [e.g. 0.1.23]

Additional Context
Add any other context about the problem here.

This module 'Az.Accounts' may override the existing commands

Your Question
Perhaps not an issue but more a question.
How do i deal with below error message. Not sure i want to override an existing module with an older one.

Additional Context
Install-Package: The following commands are already available on this system: 'Login-AzAccount,Logout-AzAccount,Resolve-Error,Send-Feedback'
The module 'Az.Accounts' may override the existing commands. If you still want to install this module 'Az.Accounts', use -AllowClobber parameter.

Power BI report fails on missing PublicIP in csv.

Describe the Bug
When performing an import of a management group and then a subscription i get the error when opening the Power BI report.
The report is unable to parse the virtual machines file as there are no public IP's available in that file.
There are virtual machines.

It seems to try to iterate an empty list.

To Reproduce
Steps to reproduce the behavior:

  1. Import a management group and then a subscription

Expected Behavior
I would expect the Power BI report to open correctly and reflect the data model it should open.

Screenshots

image

Environment (please complete the following information):

  • OS: [e.g. Windows 11]
  • PowerShell version [e.g. 7.4]
  • Module Version [e.g. 0.1.23]

Additional Context
Add any other context about the problem here.

Power BI report optimization. It has hard dependencies on all files and content.

Describe the Improvement
First, I appreciate all the effort you put into this and am really eager to use this report. Therefore, i would like to put this as an improvement instead of a bug...

The report currently can only be opened when all commands have been run and all commands export at least one instance of each resource. This is not always the case and it should not break the functionality.

So, it depends on management groups, subscriptions, all the resources imported. But also the ones from Resolve-AzureAssessPrivilegedIdentities.

So, for instance, i only ran the following command:

Get-AzureAssessResources -SubscriptionId ********-****-****-badc-311acc7edb2f

The files are generated.

image

But the report fails to open. It's missing some files which are either not generated, or contain no data.

image

Benefits
Some customers are not yet using management groups and do not have access to the root, or any management group, scope.
Also, customers do not always have all types of resources in their environment, of accessible subscription as in my case for the test i'm running.

It would be extremely helpful if the report could be opened for all scenarios.

Additional Context
Generation of an empty file with at least the headers would probably be sufficient. Now the files are completely empty.

Hardcoded path in Power BI templated prevents loading the report

Describe the Bug
It looks like one of the files used for the report still has a hard coded path and does not work with the path input parameter asked when opening the template.

To Reproduce
Steps to reproduce the behavior:

  1. Import a management group and then a subscription.
  2. Open the template and fill in the path where the CLI was run.

Expected Behavior
I would expect the Power BI report to open correctly and reflect the data model it should open.

Screenshots

image

image

Environment (please complete the following information):

  • OS: [e.g. Windows 11]
  • PowerShell version [e.g. 7.4]
  • Module Version [e.g. 0.1.23]

Additional Context
Add any other context about the problem here.

Using `Get-AzureAssessResources -ManagementGroupNames` on a Management Group with only child MG's fails

Describe the Bug
When i run the command Get-AzureAssessResources -ManagementGroupNames <NAME> on a management group that contains no subscriptions, or only contains child management groups (due to governance structure) the script fails to run.

It seems to try to iterate an empty list.

To Reproduce
Steps to reproduce the behavior:

  1. Run Get-AzureAssessResources on management groups without subscriptions.

Expected Behavior
It should not fail but handle the empty list and continue.
Best would be to iterate the sub management groups.

Screenshots

image

image

Environment (please complete the following information):

  • OS: [e.g. Windows 11]
  • PowerShell version [e.g. 7.4]
  • Module Version [e.g. 0.1.23]

Additional Context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.