Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel Report not being generated #26

Closed
azuosfernando opened this issue Aug 15, 2021 · 3 comments
Closed

Excel Report not being generated #26

azuosfernando opened this issue Aug 15, 2021 · 3 comments

Comments

@azuosfernando
Copy link

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

@ajkeane-aws
Copy link

Check the version of the az resource graph that's installed along with az cli

az --version

(This is my output)
azure-cli 2.27.1
core 2.27.1
telemetry 1.0.6

Extensions:
resource-graph 2.1.0

If it's not at 2.1.0 then remove that with

az extension remove --name -resource-graph

Now, install the latest

az extension add --name resource-graph

Try to run the script again

@ajkeane-aws
Copy link

I pulled down the latest version of this script and I can confirm the same errors -

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

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

@azuosfernando
Copy link
Author

I had checked the versions and it seemed fine, I have just updated to use Powershell 7, and now it´s working...

@ghost ghost locked as resolved and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants