microsoft / ARI

Azure Resource Inventory - It's a Powerful tool to create EXCEL inventory from Azure Resources with low effort
MIT License
1.09k stars 392 forks source link

issue when executing script #11

Closed tcarr85 closed 3 years ago

tcarr85 commented 3 years ago

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.

tcarr85 commented 3 years ago

I ran debug, and this was also an error that was present above the previous comment I posted earler. 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

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

knowlesy commented 3 years ago

Can confirm I had the same issue when running as a RO user with the Global reader role, win 10 machine, and home 365 subscription for office .

tcarr85 commented 3 years ago

Do you know what version of CLI and importexcel you're using/ i think im using the latest.

knowlesy commented 3 years ago

All latest as of this post

azure-cli 2.23.0

ModuleType Version Name ExportedCommands


Script 7.1.2 ImportExcel {Add-ConditionalFormatting, Add-ExcelChart, Add-ExcelDataV...

I have tried (didn't check what was changed) the previous version of the script with the same error noticed this and thought ID highlight the issue

tcarr85 commented 3 years ago

I tried a bunch of different version of this script, and installed lower versions of CLI and importexcel to no avail. I am not sure what happened. Do you have a work around?

Mike-Ling commented 3 years ago

Hi, first time user here... I hit the same issue:

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

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

image

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: 1.2 Minutes Total Resources: 0 Total Advisories:

ModuleType Version Name


Script 7.1.2 ImportExcel

tcarr85 commented 3 years ago

How i fixed it was: Changing : az extension add --name resource-graph to az extension add --name resource-graph --version 1.1.0 and Install-Module -Name ImportExcel -Force to Install-Module -Name ImportExcel -RequiredVersion 7.1.2 -Force

I am running this in Ado with Service principal for the login and it executed without issue. I also tested it on Desktop.

Mike-Ling commented 3 years ago

I only have version 7.1.2 of ImortExcel installed but the resource graph extension is 2.0.0: { "experimental": false, "extensionType": "whl", "name": "resource-graph", "path": "C:\Users\xxx\.azure\cliextensions\resource-graph", "preview": false, "version": "2.0.0" } Downgrading to v1.1.0 does allow the script to complete. It does throw an error, but the Excel is generated:

ERROR: { "error": { "code": "BadRequest", "message": "Please provide below info when asking for support: timestamp = 2021-05-14T17:24:35.8232410Z, correlationId = 5261deb8-0879-401a-a414-b3304306421d.", "details": [ { "code": "ResponsePayloadTooLarge", "message": "Response payload size is 35289540, and has exceeded the limit of 12582912. Please consider querying less data at a time and make paginated call if needed." } ] } }

Changes to the resource graph extension seem to have broken things.

tcarr85 commented 3 years ago

I ran az extension remove --name resource-graph and had the script reinstall it. I tested this theory by re running but upgrading importexcel and resource graph to the most recent and experiencing a failure, Im not sure if it's worth noting, I am running the recent release of azcli

ClaudioMerola commented 3 years ago

Hi,

as mentioned by Mike-Ling in the #12

Is possible this issue is related with the wrong identification of the script as CloudShell instead of Powershell Core.

I updated the script with Mike`s suggestion, can you guys try it and see how it goes?

Thanks

tcarr85 commented 3 years ago

I tested the newest script, and i am getting the same errors I posted.

ClaudioMerola commented 3 years ago

Thanks for the answer adorabletechguy. I think I found the issue.

Newest version of Resource-Graph Extension present data in a different format.

Can you try the 1.4.4?

Thanks

tcarr85 commented 3 years ago

It executed without an errors.

ClaudioMerola commented 3 years ago

Good to know.