GithubHelp home page GithubHelp logo

microsoft / ari Goto Github PK

View Code? Open in Web Editor NEW
1.1K 63.0 386.0 5.48 MB

Azure Resource Inventory - It's a Powerful tool to create EXCEL inventory from Azure Resources with low effort

License: MIT License

PowerShell 99.49% Smarty 0.51%
azure-resource-inventory inventory azure-cloudshell importexcel azure azure-inventory architecture cloud documentation powershell

ari's Issues

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.

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
[
{

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

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!

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

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

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.

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.

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.
''

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.

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."
        }

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!

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
                }
            }

Add Service Fabric cluster

Hi All ,

Thanks for the excellent script . It is really useful .

Could we add service Fabric clusters ??

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

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.

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

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

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.

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?

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

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!!

Automation problem

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

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.

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.

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

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

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

Auto-login

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

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

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!

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

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.

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>

Create NSG tab

There should be a Network Security Group tab.

I've created a PR for this.

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

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.