Reputation: 1126
I have a couple of Azure Runbooks which use AzureRM
to automatically scale service plans depending in some configuration.
That configuration is saved on my Azure Storage Account as entities in a table.
However, I can't find a way to read the entities from that table using AzureRM
in my runbooks...
I can't use any Az
modules because it would complain about also importing AzureRM
next to Az
. And I don't want to have 2 separate automation accounts just to be able to use AzureRM
and Az
at the same time.
So is there any way to get all the entities from an Azure Storage Table using the AzureRM
module?
Upvotes: 0
Views: 538
Reputation: 23141
According to my test, if you want to use AzureRm
module to get all the entities from an Azure Storage Table, you can use the modlue AzureRmStorageTable
. But please note that its version only lows than 1.0.0.23. For more details, please refer to https://github.com/paulomarquesc/AzureRmStorageTable/blob/master/ReleaseNotes.md.
For example:
try
{
# Get the connection "AzureRunAsConnection "
$servicePrincipalConnection=Get-AutomationConnection -Name $connectionName
"Logging in to Azure..."
Add-AzureRmAccount `
-ServicePrincipal `
-TenantId $servicePrincipalConnection.TenantId `
-ApplicationId $servicePrincipalConnection.ApplicationId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint
}
catch {
if (!$servicePrincipalConnection)
{
$ErrorMessage = "Connection $connectionName not found."
throw $ErrorMessage
} else{
Write-Error -Message $_.Exception
throw $_.Exception
}
}
$table = Get-AzureStorageTableTable -resourceGroup jimtest -tableName SchemasTable -storageAccountName jimtestdiag417
Get-AzureStorageTableRowAll -table $table
Regarding how to install the special version module for Azure Automation account, you can do that via the page.
Upvotes: 1
Reputation: 1126
Thank to the comment of Michale B. on my question, the following has fixed my problem:
Could also make use of the alias option in the Az module. learn.microsoft.com/en-us/powershell/module/az.accounts/… . This will allow you to use (most) AzureRM functions, while also using the Az module
Upvotes: 0