【发布时间】:2018-04-07 04:30:12
【问题描述】:
我有输出列表或格式化为表格的 powershell cmdlet。 我想将输出流式传输到 Azure 表存储以供 Power BI 访问。
这可能吗?
谢谢
【问题讨论】:
我有输出列表或格式化为表格的 powershell cmdlet。 我想将输出流式传输到 Azure 表存储以供 Power BI 访问。
这可能吗?
谢谢
【问题讨论】:
使用 Azure 存储表时,您无法直接向它们流式传输,但您可以逐行写入数据。
写入表是这样完成的
# Get the necessary modules, if needed. Latter one was not installed for me by running
# the top command.
# Install-Module AzureRM
# Install-Module AzureRMStorageTable
# Login to Azure RM model
Login-AzureRmAccount
# Some variables
$storageAccountName = <account name>
$tableName = <table name>
$partitionKey1 = <partition name
$rg = <resource group name>
# Get the storage account and its context
$storageAccount = Get-AzureRmStorageAccount -ResourceGroupName $rg `
-Name $storageAccountName
$ctx = $storageAccount.Context
# Create a new table, if needed
# New-AzureStorageTable –Name $tableName –Context $ctx
# Get a reference to the table
$storageTable = Get-AzureStorageTable –Name $tableName –Context $ctx
# Add some rows into the table
Add-StorageTableRow `
-table $storageTable `
-partitionKey $partitionKey1 `
-rowKey ("CA") -property @{"username"="Chris";"userid"=1}
有关如何使用 PowerShell 处理 Azure 存储表的更多详细信息,请参阅 this 页面。
【讨论】: