powershell - 在 PowerShell 中引用存储帐户中的文件

标签 powershell azure azure-data-factory

我有以下代码,我需要引用存储在 azure blob 存储中的 ADF 代码

foreach($file in Get-ChildItem "https://adfcicdazurestorage82.blob.core.windows.net/adfcicdazurestorage82" -filter "*LinkedService*")
{
  New-AzureRmDataFactoryLinkedService -ResourceGroupName "ADFAutomationResource" -DataFactoryName "ADFCICD190218" -Name $file.BaseName -File $file.FullName -Force | Format-List
}

这些代码行会引发错误。我需要从 azure blob 存储获取这些文件并创建链接服务。

最佳答案

您需要的是 Linked Service JSON File链接到您的存储帐户。

您的代码可能如下所示:

#PowerShell:

New-AzureRmDataFactoryLinkedService -ResourceGroupName "ADFAutomationResource" -DataFactoryName "ADFCICD190218"  -File .\AzureStorageLinkedService.json | Format-List

...以及您的链接服务 JSON 文件,如下所示(文件名:AzureStorageLinkedService.json):

     {
        "name": "AzureStorageLinkedService",
        "properties": {
            "type": "AzureStorage",
            "typeProperties": {
                "connectionString": "DefaultEndpointsProtocol=https;AccountName=adfcicdazurestorage82;AccountKey=<accountkey>"
            }
        }
     }

关于powershell - 在 PowerShell 中引用存储帐户中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48884020/

相关文章:

azure - VB6 应用程序是否在 Azure RemoteApp 中运行?

azure - 与 Azure Active Directory 的链接服务 - 密码

Azure数据工厂: Select all the table from source where date lower than pipline date

PowerShell 动态数组

powershell - 当使用调用运算符的非零退出代码时,为什么 PowerShell 脚本不会结束?

windows - 循环批处理文件

c# - Windows 服务以用户身份连接到 Azure AD (MFA)

wpf - 捕获在 Powershell 中运行的 XAML 文本框中的 Enter 键

asp.net-mvc - Azure 是否会阻止同时回收角色实例?

azure - U-SQL - 执行相关查询