Create Azure Table

I’m attempting to pull some information using the Az module and display it in a dashboard using a table. I keep getting a “Cannot bind argument to paramenter ‘Data’ because it is null” error. When I run the same script on PowerShell I get the correct data. This is the code I’m using. Do I need to find out a way to connect to the AZAccount?

New-UDRow -Columns {
    New-UDColumn -LargeSize 6 -Content {  
        New-UDRow -Columns {
            $AzureInvoicesTableData = try { 
                            Get-AzBillingInvoice | Select Name, Status, `
                            @{Name = "DueDate"; Expression = {Get-Date ($_.DueDate) -Format 'MM/dd/yyyy'}}, `
                            @{Name = "BilledAmount"; Expression={ $_.BilledAmount.Value}}, `
                            InvoiceDate, InvoicePeriodStartDate, InvoicePeriodEndDate
                        } 

                    catch {}

            $Columns = @(
                New-UDTableColumn -Property Name -Title Name -ShowSort -IncludeInExport -IncludeInSearch -ShowFilter -FilterType text
                New-UDTableColumn -Property Status -Title Status -ShowSort -DefaultSortColumn -IncludeInExport -IncludeInSearch -ShowFilter -FilterType select 
                New-UDTableColumn -Property DueDate -Title "Due Date" -IncludeInExport -ShowFilter -FilterType select
                New-UDTableColumn -Property BilledAmount -Title Amount -IncludeInExport -ShowFilter -FilterType select 
            )

            New-UDTable -Id 'Invoices' -Data $AzureInvoicesTableData -Columns $Columns -Title 'Invoices' -ShowSearch -ShowPagination -Dense 

        }
    }
}
Product: PowerShell Universal
Version: 1.5.16

Yeah. Sounds like you may need to connect something. The invoice table data variable is null and that’s why you are seeing that error.

In order for my interactions with Azure from PSU/Universal Dashboard, I have a service principal account setup with appropriate rights and signed in on the machine running the site. This allows any of the Az module commands to properly work when used. I pull Keyvault secrets, start Azure Automation runbooks,etc without issue once this is setup.