Azure SQL DB
2 TopicsPS Custom Object - Format Output
Hello, I have the following code: $dbs = Get-AzSqlDatabase -ResourceGroupName $SQLResourceGroup -ServerName $ServerName $results = foreach ($db in $dbs.DatabaseName) { $dbAudit = Get-AzSqlDatabaseAudit -ResourceGroupName $SQLResourceGroup -ServerName $ServerName -DatabaseName $db [PSCustomObject]@{ Database = $dbAudit.DatabaseName Storage = $dbAudit.BlobStorageTargetState } } $results | Format-Table -Property @{Expression={$_.DatabaseName};Label="Display Name";width=35}, ` @{Expression={$_.BlobStorageTargetState};Label="Login Name";width=40} The script originally worked before I added the FT function. Now the display is blank as shown below: Display Name Login Name ------------ ---------- If I remove the FT function it will display in key/value pairs. I'd like for it to be displayed in columnar format. Any ideas? Thanks, Frank1.3KViews0likes1CommentFormat Output into Table
Hello, My script outputs the format as follows: Subscription Name : DEV Resource Group : use2-dev-rg SQL Server Name : dev-rg-sql DataBase Name : devrg Creation Date : 10/22/2020 2:33:11 PM The output above is cutoff as there are multiple resource groups. I'd like for it to be columnar with Subscription Name, Resource Group, etc as the heading. This is the script for output: $dateString = (Get-Date).ToString("yyyyMMdd") $fileName = ("AzrSQLDatabases_" + $SubscriptionName + "_" + $dateString + ".xls") $AzureSQLBackupInventory | Out-File ("C:\Temp\" + $fileName) Thanks in advance for your help!896Views0likes1Comment