【问题标题】:How to stream Azure Powershell output to Azure table storage如何将 Azure Powershell 输出流式传输到 Azure 表存储
【发布时间】:2018-04-07 04:30:12
【问题描述】:

我有输出列表或格式化为表格的 powershell cmdlet。 我想将输出流式传输到 Azure 表存储以供 Power BI 访问。

这可能吗?

谢谢

【问题讨论】:

    标签: azure azure-powershell


    【解决方案1】:

    使用 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 页面。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-03
    • 2019-01-27
    • 2013-02-08
    • 2019-12-29
    • 2013-11-08
    • 2019-10-14
    • 2015-06-10
    • 2013-08-21
    相关资源
    最近更新 更多