Giter Club home page Giter Club logo

ari's Introduction

ArtifactType Language Platform Tags
Excel spreadsheet with the full Azure environment
Powershell
Windows / Linux / Mac
Powershell, Azure, Inventory, Excel Report, Customer Engineer

GitHub GitHub repo size Azure

GitHub last commit GitHub top language


Logo

Azure Resource Inventory

Azure Resource inventory (ARI) is a powerful script written in powershell that generates an Excel report of any Azure Environment you have read access.

This project is intend to help Cloud Admins and anyone that might need an easy and fast way to build a full Excel Report of an Azure Environment.


What's new ?


Version 3 is alive!!


Overview


Among the many improvements, those are the highlights of the new version:


1) Support for 6 extra resource types, including NetApp and VMWare Solution.


Since the begining of the project, we wanted ARI to evolve and keep pace with the improvements on Azure Resources. Keeping that in mind we are adding extra modules for newer resources.

We also reviewed and updated some of the old resources as well.


2) Diagram was completely rebuild and now support environments with more than 30.000 resources


Network Topology was cool but in large environments it had some problems (i.e.: freezing and never finishing), and even when it finished it might take forever.

We added parallel processing to diagram, now during the execution of ARI, an extra folder (DiagramCache) will be created, that folder is used by the diagram to store temporary components of the diagrams, after all the parallel processing is done those files are merged in the main diagram.

Now diagram will even finish way before the Excel file.


3) Network Topology in the Diagram now identifies the Hub and Spokes Virtual Network


Draw.IO


Tab names were added in the diagram and now the Network Topology is the first tab.

Also in the Network Topology, we are using color in the diagram to identify the different Virtual Network usages in HUB-Spoke topologies.

Colors will also be used to indicate broken peers.


4) Diagram now include "Organizational View" (Management Groups)


Draw.IOOrg


We added extra tabs in the new diagram, the second tab is called "Organization" and will present the hierarquical view of subscriptions in the environment.

The idea is to make easier to align your environment with the Microsoft's Landing Zone design (What is an Azure landing zone).


5) Diagram now include Resource Overview for every subscription in the environment


Draw.IOOrg


Since not everyone have really complex network environments, many people complain about diagram not really presenting much for their environments.

This change now. Every single Subscription will be a tab in the diagram, those tabs will contain the Subscription, the resource groups and the sum of every type of resource in the resource groups. By now almost every type of draw.io stencil available will be identified, with more coming in the next months.


6) ARI in Automation Account


Overview


Some people were asking to run ARI in Azure Automation Account and since the old script for automation accounts was not working we managed to fix it for this version. But now is require to use Runtime 7.2 and add the modules: "ImportExcel", "Az.ResourceGraph", "Az.Storage", "Az.Account" and "ThreadJob" in the Automation Account.

The required steps are present in the: Automation Guide.



1) Excel Overview



  • The dashboard shows an overall view and summary of resources in the environment.

Overview


  • The resource sheet present details and recommendations, security and costs reducing tips for the resources.

Overview


2) Azure Diagram Inventory!


By default everytime you run the Azure Resource Inventory the diagram will be created.

If you do not wish to have the diagram created, you must use the -SkipDiagram parameter.

Also, by default the Network Topology will not consider Virtual Networks that are not connected trough peering. If you wants to include those Virtual Networks in the diagram, you must use the parameter -DiagramFullEnvironment.


Diagram:



  • An extra detail is that if you hover the mouse cursor over any resource in the Network Topology you get the resource details:


  • This feature is available for any resource and even peering lines:



3) Parameters

Parameter Description
TenantID Specify the tenant ID you want to create a Resource Inventory. -TenantID <ID>
AppId Service Principal Authentication -AppId <Client ID>
Secret Client secret of the Service Principal -Secret <Client secret>
SubscriptionID Specifies Subscription(s) to be inventoried. -SubscriptionID <ID>
ManagementGroup Specifies the Management Group to be inventoried(all Subscriptions on it) -ManagementGroup <ID>
Lite Speficies to use only the Import-Excel module and don't create the charts (using Excel's API) -Lite
SecurityCenter Include Security Center Data. -SecurityCenter
SkipAdvisory Do not collect Azure Advisory. -SkipAdvisory
IncludeTags Include Resource Tags. -IncludeTags
Debug Run in a Debug mode. -Debug
DiagramFullEnvironment Network Diagram of the entire environment -DiagramFullEnvironment
Diagram Create a Visio Diagram. -Diagram
SkipDiagram To skip the diagrams creation -SkipDiagram
DeviceLogin Authenticating on Azure using the Device login approach -DeviceLogin
AzureEnvironment Choose between Azure environments
> Registered Azure Clouds. Use az cloud list to get the list
-AzureEnvironment <NAME>
ReportName Change the Default Name of the report. Default name: AzureResourceInventory -ReportName <NAME>
ReportDir Change the Default path of the report. -ReportDir "<Path>"
Online Use Online Modules. Scan Modules diretly in GitHub ARI Repository -Online
ResourceGroup Specifies one unique Resource Group to be inventoried, This parameter requires the -SubscriptionID to work. -ResourceGroup <NAME>
TagKey Specifies the tag key to be inventoried, This parameter requires the -SubscriptionID to work. -TagKey <NAME>
TagValue Specifies the tag value be inventoried, This parameter requires the -SubscriptionID to work. -TagValue <NAME>
QuotaUsage Quota Usage -QuotaUsage

Examples

  • For CloudShell:
    />./AzureResourceInventory.ps1
  • Powershell Desktop:
    />./AzureResourceInventory.ps1

    If you do not specify Resource Inventory will be performed on all subscriptions for the selected tenant. To perform the inventory in a specific Tenant and subscription use -TenantID and -SubscriptionID parameter

      />./AzureResourceInventory.ps1 -TenantID <Azure Tenant ID> -SubscriptionID <Subscription ID>
  • Including Tags:
    />./AzureResourceInventory.ps1 -TenantID <Azure Tenant ID> --IncludeTags

    By Default Azure Resource inventory do not include Resource Tags.

  • Collecting Security Center Data:
    />./AzureResourceInventory.ps1 -TenantID <Azure Tenant ID> -SubscriptionID <Subscription ID> -SecurityCenter

    By Default Azure Resource inventory do not collect Security Center Data.

  • Skipping Azure Advisor:
    />./AzureResourceInventory.ps1 -TenantID <Azure Tenant ID> -SubscriptionID <Subscription ID> -SkipAdvisory

    By Default Azure Resource inventory collects Azure Advisor Data.

  • Creating Network Diagram:
    />./AzureResourceInventory.ps1 -TenantID <Azure Tenant ID> -Diagram

Getting Started


These instructions will get you a copy of the project up and running on your local machine or CloudShell.


Supportability

Resource Provider Results Draw.io Diagram Comments
Windows Fully successfully tested Supported Best Results
MAC Fully successfully tested Not Supported
Linux Tested on Ubuntu Desktop Not Supported No Table auto-fit for columns
CloudShell Tested on Azure CloudShell Not Supported No Table auto-fit for columns

Our Test Environment:

Tool Version
Windows 11 22H2
Powershell 5.1.19041.1237
ImportExcel 7.8
azure-cli 2.48.1
AzCLI account 0.2.3
AzCLI resource-graph 2.1.0

Prerequisites

You can use Azure Resource Inventory in both in Cloudshell and Powershell Desktop.

What things you need to run the script

  1. Install-Module ImportExcel
  2. Install Azure CLI
  3. Install Azure CLI Account Extension
  4. Install Azure CLI Resource-Graph Extension

By default Azure Resource Inventory will call to install the required Powershell modules and Azure CLI components but you must have administrator privileges during the script execution.

Special Thanks for Doug Finke, the Author of Powershell ImportExcel Module.



⚠️ Warnings


Very Important: Azure Resource Inventory will not upgrade the current version of the Powershell modules.


Important: If you're running the script inside Azure CloudShell the final Excel will not have Auto-fit columns and you will see warnings during the script execution (but the results of your inventory will not be changed :)

CloudShell Warnings


Running the script


  • Its really simple to use Azure Resource Inventory, all that you need to do is to call this script in PowerShell.

  • Run "AzureResourceInventory.ps1". In Azure CloudShell you're already authenticated. In PowerShell Desktop you will be redirected to Azure sign-in page.


Tenants Menu

  • If you have privileges in multiple tenants you can specify the desired one by using "-TenantID" parameter or Azure Resource will scan all your tenants ID and ask you to choose one.

Tenants Menu

  • After properly authenticated and with the TENANT selected, the Azure Resource Inventory will perform all the work of extracting and creating the inventory.

  • The duration will vary according to the number of subscriptions and resources. In our tests we managed to generate in 5 minutes the inventory of a Tenant with 15 subscriptions and about 12000 resources.

  • Azure ResourceInventory uses "C:\AzureResourceInventory" as default folder for PowerShell Desktop in Windows and "$HOME/AzureResourceInventory" for Azure CloudShell to save the final Excel file.

  • This file will have the name "AzureResourceInventory_Report_yyyy-MM-dd_HH_mm.xlsx" where "yyyy-MM-dd_HH_mm" are the date and time that this inventory was created.


Versioning and changelog


We use SemVer for versioning. For the versions available, see the tags on this repository.

We also keep the CHANGELOG.md file in repository to Document version changes and updates.


Authors

The main authors of this project are:

  1. Claudio Merola ([email protected])
  2. Renato Gregio


Contributing

Please read our CONTRIBUTING.md which outlines all of our policies, procedures, and requirements for contributing to this project.





About the tool


Copyright (c) 2018 Microsoft Corporation. All rights reserved.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.




Trademarks


This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.


ari's People

Contributors

anotherbridge avatar bweissman avatar chrislewis3cloud avatar chrismissal avatar christopherglewis avatar claudio-merola avatar claudiomerola avatar davymartu avatar edneimonteiro avatar emfl avatar foysters avatar jfmatth avatar krislev avatar microsoft-github-policy-service[bot] avatar quintindk avatar renatogregio avatar rubaroca avatar seppohto avatar tanure 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ari's Issues

Update Automation script to the latest version

Hello team.

I have been an active user to this tool and I'm very happy to use it because it works very well. Currently I'm performing the automation part to save the Excel files directly in the Storage Account, but I realize the code that is in the folder Automation is for the 2.1.0 version and the latest version of the ARI script is on 2.1.10 version. I would like to know, how could I update the Automation script to get the Excel files on the latest version? It is possible to copy the AzureResourceInventory.ps1 code into the runbook and run? I've tried this but I get the Excel file without the variables (SecurityCenter, IncludeTags, etc).

Thanks for this tool.

Still the same issue as was referenced in #18

When I run the script, an Excel file is generated, but there is nothing in it. During execution, the following messages appear:

ARI

These are the exact same messages that StanleyCruvinel posted within his issue. However, in my case it does not seem to be solved with version 1.4.11

The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and can be set.

\AzureResourceInventory.ps1 -TenantID ********************************* -IncludeTags -SecurityCenter
Validating Az Cli..
Validating Az Cli Extension..
Validating ImportExcel Module..
PowerShell Desktop Identified.

Azure Resource Inventory are collecting Security Center Advisories.
Collecting Security Center Can increase considerably the execution time of Azure Resource Inventory and the size of final report

If you want to skip Security Center report use <-SkipSecurityCenter> parameter.

The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files (x86)\WindowsPowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:107 char:17

  • ... $Range.Style.HorizontalAlignment = $HorizontalAlignment
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'Format' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files (x86)\WindowsPowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:128 char:17

  • ... $Range.Style.Numberformat.Format = (Expand-NumberFormat $ ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

WARNING: Failed autosizing columns of worksheet 'Availability Sets': You cannot call a method on a null-valued expression.
Report Complete. Total Runtime was: 3.23 Minutes
Total Resources: 1603
Total Advisories: 1223
Total Security Advisories: 2284

Visio file is not found

Hi Team,

I would like to thanks for your great work first =).

After the script was run successfully, the visio file is not found, do I have to install the Visio? As it is not listed in section Prerequisites.
image

Thanks!!

Testing the tool

Busy testing the tool and initially was failing, i needed the latest CLI version then started running..

Guess we do have largish environment - picked up on the error below.

        {
            "code": "ResponsePayloadTooLarge",
            "message": "Response payload size is 19749321, and has exceeded the limit of 12582912. Please consider querying less data at a time and make paginated call if needed."
        }

issue when executing script

I was using this script without an issue for the last couple of weeks
I am not getting
WARNING: Failed autosizing columns of worksheet 'Subscriptions': You cannot call a method on a null-valued expression.
WARNING: Failed adding PivotTable 'P1': Index operation failed; the array index evaluated to null.
WARNING: Failed adding chart for pivotable 'P1': Cannot bind argument to parameter 'PivotTable' because it is null.
Report Complete. Total Runtime was: .4 Minutes

It appears that my tenantID isn't being populated also, regardless if I use the TenantID switch or not.

Auto-login

Hello team, Is there an option to skip the login using a SAS token or something else? Thanks.

Receiving Horizontal Alignment issue on latest version of the script

I currently am running powershell 7.1.4

azure-cli 2.27.1

core 2.27.1
telemetry 1.0.6

Extensions:
resource-graph 2.1.0

InvalidOperation: C:\Users\ajkeane\Documents\PowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:107
Line |
107 | … $Range.Style.HorizontalAlignment = $HorizontalAlignment
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and
| can be set.
az account list
InvalidOperation: C:\Users\ajkeane\Documents\PowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:128
Line |
128 | … $Range.Style.Numberformat.Format = (Expand-NumberFormat $ …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'Format' cannot be found on this object. Verify that the property exists and can be set.
https://docs.microsoft.com/en-US/cli/azure/account#az_account_set
WARNING: Failed autosizing columns of worksheet 'Subscriptions': You cannot call a method on a null-valued expression.
WARNING: Failed adding PivotTable 'P1': Index operation failed; the array index evaluated to null.
WARNING: Failed adding chart for pivotable 'P1': Cannot bind argument to parameter 'PivotTable' because it is null.

Error "BadRequest" when running the script

Here is the Error I get when running the script.

GitCommitId 7.1.5
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
182-776f-4a9c-b96e-8fdb9f46b2b3.",
"details": [
{
"code": "DisallowedLogicalTableName",
"message": "Table advisorresources is invalid, unsupported or disallowed."
}
]
}
}
Azure Resource Inventory are collecting Security Center Advisories.
Collecting Security Center Can increase considerably the execution time of Azure Resource Inventory and the size of final report

ERROR: {
"error": {
"code": "BadRequest",
"message": "Please provide below info when asking for support: timestamp = 2021-11-03T21:40:06.9146572Z, correlationId = bf6f0bac-dac0-49c4-ba4e-27ce82ee330f.",
"details": [
{
"code": "DisallowedLogicalTableName",
"message": "Table desktopvirtualizationresources is invalid, unsupported or disallowed."
}
]
}
}
Report Complete. Total Runtime was: 1.08 Minutes
Total Resources: 0
Total Advisories: 0
Total Security Advisories: 194

Feature request

A very big shout out to begin with. Very nice and useful script! Thanks! My remarks below are not really issues, more questions / feature requests.

As a feature request, I would kindly ask for the inclusion of the 'new' Azure stuff like Functions Apps, Logic App, API Connections etc.

And for the Azure Advisor part (which is already included, but a basic level), it would be nice to have for instance the savings per year (reservations etc.) included.

How is the 'Advisory score' calculated at the first page of the Excel sheet? It doesn't seem to corelate with any item within the portal. It's something different from the Advisor Score (Preview) or Secure Score. Where does this originate from?

Others good Types

type order in script
microsoft.automation/automationaccounts 12
microsoft.compute/availabilitysets 21
microsoft.compute/disks 2
microsoft.compute/virtualmachines 1
microsoft.compute/virtualmachines/extensions 7
microsoft.compute/virtualmachinescalesets 23
microsoft.containerinstance/containergroups 20
microsoft.containerservice/managedclusters 19
microsoft.dbformysql/servers 15
microsoft.dbforpostgresql/servers 16
microsoft.devices/iothubs 32
microsoft.eventhub/namespaces 14
microsoft.keyvault/vaults 29
microsoft.network/applicationgateways 27
microsoft.network/dnszones 31
microsoft.network/frontdoors 26
microsoft.network/loadbalancers' 24
microsoft.network/networkinterfaces 5
microsoft.network/networksecuritygroups 6
microsoft.network/publicipaddresses 13
microsoft.network/routetables 28
microsoft.network/virtualnetworkgateways 8
microsoft.network/virtualnetworks 4
microsoft.operationalinsights/workspaces 18
microsoft.recoveryservices/vaults 30
microsoft.sql/servers 10
microsoft.sql/servers 25
microsoft.sqlvirtualmachine/sqlvirtualmachines 9
microsoft.storage/storageaccounts 3
microsoft.web/serverfarms 17
microsoft.web/sites 22
others
microsoft.insights/actiongroups
microsoft.insights/activitylogalerts
microsoft.insights/components
microsoft.insights/metricalerts
microsoft.insights/workbooks
microsoft.logic/integrationaccounts
microsoft.logic/workflows
microsoft.maps/accounts
microsoft.network/bastionhosts
microsoft.network/networkwatchers
microsoft.network/privatednszones
microsoft.network/privatednszones/virtualnetworklinks
microsoft.portal/dashboards
microsoft.search/searchservices
microsoft.sql/servers
microsoft.sql/servers/databases
microsoft.sqlvirtualmachine/sqlvirtualmachines
microsoft.streamanalytics/streamingjobs
microsoft.web/certificates
microsoft.web/connectiongateways
microsoft.web/connections
microsoft.web/serverfarms

Draw.io problem

Draw.io is not generated

Hello, in draw.io only one diagram page is generated. My infrastructure has more than 10,000 resources

Failed autosizing columns of worksheet 'Subscriptions'

''
The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files\WindowsPowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:107 char:17

  • ... $Range.Style.HorizontalAlignment = $HorizontalAlignment
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'Format' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files\WindowsPowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:128 char:17

  • ... $Range.Style.Numberformat.Format = (Expand-NumberFormat $ ...
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

WARNING: Failed autosizing columns of worksheet 'Subscriptions': You cannot call a method on a null-valued expression.
WARNING: Failed adding PivotTable 'P1': Index operation failed; the array index evaluated to null.
WARNING: Failed adding chart for pivotable 'P1': Cannot bind argument to parameter 'PivotTable' because it is null.
''

Add Service Fabric cluster

Hi All ,

Thanks for the excellent script . It is really useful .

Could we add service Fabric clusters ??

Latest version giving alignment errors

Running the script gives the following errors - also provided the current versions of everything and I updated to the latest.

get-module importexcel

ModuleType Version Name ExportedCommands


Script 7.1.2 ImportExcel

$psversiontable.psversion

Major Minor Patch PreReleaseLabel BuildLabel


7 1 2

az --version
azure-cli 2.23.0
core 2.23.0
telemetry 1.0.6
Extensions:
resource-graph 1.1.0

Errors-

The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files\WindowsPowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:107 char:17

  • ... $Range.Style.HorizontalAlignment = $HorizontalAlignment
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'Format' cannot be found on this object. Verify that the property exists and can be set.
At C:\Program Files\WindowsPowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:128 char:17

  • ... $Range.Style.Numberformat.Format = (Expand-NumberFormat $ ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

WARNING: Failed autosizing columns of worksheet 'Subscriptions': You cannot call a method on a null-valued expression.
WARNING: Failed adding PivotTable 'P1': Index operation failed; the array index evaluated to null.
WARNING: Failed adding chart for pivotable 'P1': Cannot bind argument to parameter 'PivotTable' because it is null.
Report Complete. Total Runtime was: .83 Minutes

AzureResourceInventory.ps1

I ran the AzureResourceInventory.ps1 script that didn't show any error, including pointing out that the generated excel file was saved in C:\AzureResourceInventory. the problem is that when accessing this repository there is nothing saved there, can you help?
Screenshot_13

Support for newer versions of PowerShell?

Hi there, you label this as compatible with the legacy Windows PowerShell (Desktop) and CloudShell, but do you officialy support PowerShell Core (6 and later) on Windows 10? I was hit by issue #11 when testing so I could not confirm but I did spot a few things that prevent use as is.

Firstly, function checkAzCli() uses Get-InstalledModule to test for the existence of the ImportExcel. From PowerShell Core, the cmdlet can not detect ImportExcel if it is installed in a Windows PowerShell folder, mine is installed to:

C:\Program Files\WindowsPowerShell\Modules\ImportExcel

I install modules that are compatible with both Desktop and Core in Desktop folders so I only have one set of modules to manage and Desktop can't import modules from a Core folder.

Changing line 73 as follows would work:
$VarExcel = Get-Module -Name ImportExcel -ListAvailable -ErrorAction SilentlyContinue

Secondly, checkAzCli() attempts to install ImportExcel if not found but does so using default settings. This attempts to install the module using the CurrentUser scope which does not work so well for my situation (which can't be unique). With folder redirection enabled, PowerShell attempts to install the module to a network drive which slows things down, but as said network drive is at the other end of a slow VPN it is pretty much unusable. I'm forced to set the scope to AllUsers so I would rather the script did not attempt to install at all.

Lastly, function checkPS() tests $PSVersionTable.PSEdition for 'Desktop' and but does not test for 'Core' so defaults to 'CloudShell' when running on 'Core'. The $Global:PSEnvironment variable is never used in the script so not sure what purpose that function serves?

Here is my PS config:

Name Value


PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Thanks!

Mike

How to make Visio?

I’ve cloned locally the repo. It runs against my resources. Is there a plug-in for Visio or do I need to have Visio installed locally?

Run on Linux pwsh core

Tested script on Ubuntu 18.04 I'm getting follow errors

Powershell Core - 7.1.0
ImportExcel - 7.1.1
Azgraph - preview extension installed in az CLI

log.txt

No draw.io diagram produced

Hi!

Thanks for producing this awesome script!!

I'm keen to have it produce a diagram, but when using the Diagram param no diagram is produced.
I'm using a MacBook and have draw.io installed.
When i use the Debug param, the script appears to start and complete DrawDiagram:

DEBUG: Checking if Draw.io Diagram Job Should be Run.
DEBUG: Starting Draw.io Diagram Processing Job.
DEBUG: Checking if Visio Diagram Job Should be Run.
DEBUG: Starting Visio Diagram Processing Job.
DEBUG: Checking If Should Run Security Center Job.
DEBUG: Checking If Should Run Advisory Job.
DEBUG: Starting Advisory Processing Job.
DEBUG: Starting Subscriptions job.
DEBUG: Starting Compute Processing Job.
DEBUG: Starting Networking Processing Job.
DEBUG: Starting Infrastructure Processing Job.
DEBUG: Starting Database Processing Job.
DEBUG: Starting Jobs Collector.
DEBUG: Current Status of Job:DrawDiagram. is: Running
DEBUG: Current Status of Job:VisioDiagram. is: Running
DEBUG: Current Status of Job:Advisory. is: Running
DEBUG: Current Status of Job:Subscriptions. is: Running
DEBUG: Current Status of Job:Compute. is: Running
DEBUG: Current Status of Job:Networking. is: Running
DEBUG: Current Status of Job:Infrastructure. is: Running
DEBUG: Current Status of Job:Database. is: Running
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure Database
DEBUG: Jobs Still Running: Subscriptions Compute Networking Infrastructure
DEBUG: Jobs Still Running: Subscriptions Compute
DEBUG: Jobs Still Running: Compute
DEBUG: Jobs Still Running: Compute
DEBUG: Jobs Still Running: Compute
DEBUG: Jobs Still Running: Compute
DEBUG: Jobs Compleated.

Thanks!

Additional examples of running v2

This looks fantastic. However - I run the main script but how do I have it call out to the newer items for v2?
can you provide some example of running this with the new module. Thanks!

Update Azure VMs to total by disk type for HDD/SDD/Premium SDD

Right now - you can mix and match disks in a vm and it will say 4 disks and 40GB of storage but this could be made up of 2 SSD's at 16GB each and 2 four GB disks of Standard HDD. Can you update the current vm's script with this?

What I currently am doing is the following - here's a code snip and you can see all 3 types of disks broken out and totaled -

                OsDiskSizeGB               = ""
                OsSku                      = ""
                TotalDiskSizeHDDStandardGB = ""
                TotalDiskSizeSSDStandardGB = ""
                TotalDiskSizeSSDPremiumGB  = ""
            }
            
            $info.SubscriptionName = $subscription.Name
            $info.VmName = $vm.Name 
            $info.ResourceGroupName = $vm.ResourceGroupName 
            $info.Region = $vm.Location 
            $info.VmSize = $vm.HardwareProfile.VmSize
            $info.HUBLicense = $vm.LicenseType
            $info.VirtualNetwork = $nic.IpConfigurations.subnet.Id.Split("/")[-3] 
            $info.OsType = $vm.StorageProfile.OsDisk.OsType
            $info.NicCardName = $nic.Name
            $info.Subnet = $nic.IpConfigurations.subnet.Id.Split("/")[-1] 
            $info.PrivateIpAddress = $nic.IpConfigurations.PrivateIpAddress 
            foreach ($publicIp in $publicIps) { 
                if ($nic.IpConfigurations.id -eq $publicIp.ipconfiguration.Id) {
                    $info.PublicIPAddress = $publicIp.ipaddress
                } 
            } 
            $info.OsType = $vm.StorageProfile.OsDisk.OsType 
            $info.OsDiskSizeGB = $vm.StorageProfile.OsDisk.diskSizeGB
            $info.OsSku = $vm.StorageProfile.ImageReference.Sku
            
            $info.TotalDiskSizeHDDStandardGB = 0
            $info.TotalDiskSizeSSDStandardGB = 0
            $info.TotalDiskSizeSSDPremiumGB = 0
            foreach ($datadisk in $vm.StorageProfile.DataDisks) {
                if ($datadisk.ManagedDisk.StorageAccountType -eq "Standard_LRS") {
                    $info.TotalDiskSizeHDDStandardGB += $datadisk.DiskSizeGB
                }
                if ($datadisk.ManagedDisk.StorageAccountType -eq "StandardSSD_LRS") {
                    $info.TotalDiskSizeSSDStandardGB += $datadisk.DiskSizeGB
                }
                if ($datadisk.ManagedDisk.StorageAccountType -eq "Premium_LRS") {
                    $info.TotalDiskSizeSSDPremiumGB += $datadisk.DiskSizeGB
                }
            }

Change Conditional Format in Public IPs Sheet

Hello Team, I'm testing the new version of this great tool and I have a recommendation for you. The "Public IPs" Sheet have a conditional format configured on Column I for text "Underutilized". But now, this text can be found in Column J.

Is just a little change to the next version.

Have a nice day.

No subscription found on Azure Government tenant

Hi. This script is saying I don't have any subscriptions on my Microsoft Azure Government Tenant.

I am a member of the Owner role for the subscription.

It does work correctly on one of my other non-government tenants.
Love the output so I really want to get it working on the government tenant.

The attached image shows the unsuccessful attempt to inventory my government tenant.

Thank you.

image

VISIO drawing not working properly

Hi.
I ran this script in 2 different tenants.
Tenant1: it had a few services/objects (only 19 resources), created excel file and drew the visio file perfectly - all services there.
Tenant2: it had 484 services/objects, created the excel file but the visio file only showed express route and 1 wan connection. Nothing else was show.
I ran it from the same Windows machine, same software versions (same as yours).
Any thoughts?

Tenant1:
image

Tenant2:
image

Issue while running the script

Hi Team we are facing below error while running the script using powershell console.

Credentials have expired due to inactivity please run az login.

ERROR: AADSTS700082: The refresh token has expired due to inactivity.

Excel file not generated

Hi , I am having issue of generating the excel file. After executing the powershell > login to azure subscription >I get the following log

You have privileges only in One Tenant

Extracting from Tenant 346fecb8-a16f-4aa3-b3a9-e4be59dadaca

To include Security Center details in the report, use <-SecurityCenter> parameter.

Report Complete. Total Runtime was: .35 Minutes
Total Resources: 74
Total Advisories:

Excel file saved at: C:\AzureResourceInventory\AzureResourceInventory_Report_2021-06-03_16_13.xlsx

When I navigate to C:\AzureResourceInventory the excel file is not there. Please assist me'

Regards,
Sheng Hou

Arquivo Visio não é gerado

Olá amigo, como estão?
Estou rodando o script e alguns tenants mas em nenhum deles consigo que o arquivo Visio seja montado de fato.

O final do script me informa que dois arquivos foram gerados (xlsx e vsdx) entretanto apenas o Excel é criado.

Alguma dica?

Abraço e parabéns pelo trabalho

The '<' operator is reserved for future use.

Ignorem,

Revisei todo o ambiente e consegui rodar o script sem problemas.

Muito obrigado pessoal.

Oi pessoal, tudo bem?

Tentei rodar o script no meu desktop e também via cloudshel e me foi retornado o seguinte erro:

Aqui rodei o cloudshell, mas o erro retornado foi o mesmo no desktop.

PS /home/lab> ./AzureResourceInventory.ps1
ParserError: /home/lab/AzureResourceInventory.ps1:235
Line |
235 | … -details-target btn-link d-lg-none mt-1 color-fg-inherit"> <svg aria …
| ~
| The '<' operator is reserved for future use.

AzureREsourceInventory_error

Desde já agradeço a ajuda e o excelente trabalho de vocês.

AZ CLI vs. PowerShell Az.ResourceGraph

Is there a reason that you're using AZ CLI and graph query rather than the native PS Az.ResourceGraph at (https://www.powershellgallery.com/packages/Az.ResourceGraph)?

I'm not sure of the plans to move this to the Az module but would imagine it would eventually. I did a spot check comparison of the objects returned and it should be a one-for-one swap and would reduce the dependencies of the project and most likely would have the same performance.

Excel file not generated

I found an issue while I was testing the tool, It ran OK but no excel file was created after it completed.
The folder C:\AzureGrinder was empty and no excel report was created:
Report Complete. Total Runtime was: 4.79 Minutes
Total Resources: 2009
Total Advisories: 1247
Total Security Advisories: 1022

Excel file saved at: C:\AzureGrinder\AzureGrinder_Report_2020-12-04_16_52.xlsx

I had to manually install the Powershell Module ImportExcel using "install-module importexcel" and then I was able to successful run the report.

Excel Report not being generated

Can you please help me?

When I run the script the Excel File is not generated. I don't know if it is a problem with the ImportExcel Module.

The script output is below:

To include Security Center details in the report, use <-SecurityCenter> parameter.

ERROR: argument --subscription/-s: expected one argument

TRY THIS:
az account set --subscription mysubscription
Set a subscription to be the current active subscription. (autogenerated)

az account list
Get a list of subscriptions for the logged in account. (autogenerated)

az account show
Get the details of a subscription. (autogenerated)

https://docs.microsoft.com/en-US/cli/azure/account#az_account_set
Read more about the command in reference docs
The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and can be set.
At C:\Documents\WindowsPowerShell\Modules\ImportExcel\7.2.2\Public\Set-ExcelRange.ps1:107 char:17

  • ... $Range.Style.HorizontalAlignment = $HorizontalAlignment
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

The property 'Format' cannot be found on this object. Verify that the property exists and can be set.
At C:\Documents\WindowsPowerShell\Modules\ImportExcel\7.2.2\Public\Set-ExcelRange.ps1:128 char:17

  • ... $Range.Style.Numberformat.Format = (Expand-NumberFormat $ ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : PropertyNotFound

WARNING: Failed autosizing columns of worksheet 'Subscriptions': You cannot call a method on a null-valued expression.
WARNING: Failed adding PivotTable 'P1': Index operation failed; the array index evaluated to null.
WARNING: Failed adding chart for pivotable 'P1': Cannot bind argument to parameter 'PivotTable' because it is null.
Report Complete. Total Runtime was: .26 Minutes
Total Resources: 0
Total Advisories: 309

Excel file saved at: AzureResourceInventory_Report_2021-08-14_23_34.xlsx

PS C:\Documents\Scripts\MyAzureScripts\ARI> az account list --output json
[
{

Automation problem

When the script is implemented in an automation account, the output brings more virtual machines than there are.

The property 'HorizontalAlignment' and 'Format' cannot be found on this object

Hello,
Can you please take a look on these 2 issues and let me know how I can contribute anyhow to troubleshooting..

I think is related to APIM that get failed.. maybe that´s why get this issue.

To include Security Center details in the report, use <-SecurityCenter> parameter.

InvalidOperation: C:\Users\fpereira9\Documents\PowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:107
Line |
107 | … $Range.Style.HorizontalAlignment = $HorizontalAlignment
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'HorizontalAlignment' cannot be found on this object. Verify that the property exists and
| can be set.

InvalidOperation: C:\Users\fpereira9\Documents\PowerShell\Modules\ImportExcel\7.1.2\Public\Set-ExcelRange.ps1:128
Line |
128 | … $Range.Style.Numberformat.Format = (Expand-NumberFormat $ …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The property 'Format' cannot be found on this object. Verify that the property exists and can be set.

WARNING: Failed autosizing columns of worksheet 'APIM': You cannot call a method on a null-valued expression.
Report Complete. Total Runtime was: 5.74 Minutes
Total Resources: 15976
Total Advisories: 11115

Excel file saved at: C:\AzureResourceInventory\AzureResourceInventory_Report_2021-06-10_16_37.xlsx

PS C:\Users\fpereira9\Downloads\ARI>

Visio File is not created - Tried in Windows 10 and in 2016 Server

Hi,
First of all, thank you for writing such a wonderful script. I was trying to get the diagram created but it never creates the file at the mentioned location. I have tried PowerShell and ISE mode as well but it doesn't work. VISIO is also installed with the correct License as well.

Please let me know if I am doing anything wrong. Thanks.
image

new Festure EventHubs

Hi @ClaudioMerola

Please check this out !
Deep details about EventHubs, shell script!

maybe you can add in this project !

#!/bin/bash


for nameEventHub in $(az eventhubs namespace list -o tsv --query "sort_by([].{name:name},&name)"); do
	rgName=$(az eventhubs namespace list -o tsv --query "[?name=='$nameEventHub'].resourceGroup")
	endPointService=$(az eventhubs namespace list -o tsv --query "[?name=='$nameEventHub'].serviceBusEndpoint")
		
	for queueEventHub in $(az eventhubs eventhub list -o tsv --resource-group $rgName --namespace-name $nameEventHub --query "[].name"); 
		query="[].{queueEventHub:'$queueEventHub',rgName:'$rgName',eventHub:'$nameEventHub',endPoint:'$endPointService',consumerGroup:name}"
		k=$(az eventhubs eventhub consumer-group list -o table --resource-group $rgName --namespace-name $nameEventHub --eventhub-name $queueEventHub --query "$query")
		echo "\n$k" 
	done
	
done

if you have any suggestions to make output json merged, please let me know!

Create NSG tab

There should be a Network Security Group tab.

I've created a PR for this.

Stuck at 4% of script

This script sounds like a very useful tool. However, when I try the script within PowerShell Desktop to create an inventory (multiple Azure environments in which I'm both Global Administrator and Owner/Contributor), it hangs at '4% Complete, Starting Resources extraction jobs'. The script does not go beyond that step, even when I wait for a very long time. The logon is successful and if more than 1, I see a list of tenants from which I can choose, but after that the fun is over. There is no error displayed.

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.