Skip to content

Instantly share code, notes, and snippets.

@itpropro
Created October 8, 2019 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itpropro/5fbb2f24b0122f494d89a3b2be9342ce to your computer and use it in GitHub Desktop.
Save itpropro/5fbb2f24b0122f494d89a3b2be9342ce to your computer and use it in GitHub Desktop.
$storageTable = (Get-AzStorageTable -Context $storageContext -Name $storageTableName).CloudTable
$resources = Search-AzGraph -Query 'where type !in ("microsoft.compute/virtualmachines/extensions", "microsoft.compute/restorepointcollections", "microsoft.portal/dashboards")| project id, name, location, resourceGroup, properties.storageProfile, properties.hardwareProfile, type' -First 2000
foreach ($res in $resources) {
$properties = $res.PSObject.Properties
$tableEntry = @{}
foreach ($prop in $properties) {
if ($prop.value) {
$tableEntry.add($prop.name, $prop.value)
}
}
$null = Add-AzTableRow -table $storageTable -partitionKey 'westeurope' -rowKey $res.id.replace('/','') -property $tableEntry -UpdateExisting
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment