【问题标题】:Creating Credentials in Azure Data Factory using PowerShell or RestApi使用 PowerShell 或 RestApi 在 Azure 数据工厂中创建凭据
【发布时间】:2022-12-17 18:22:55
【问题描述】:

有一篇关于在 Azure 数据工厂中添加凭证的文章:https://learn.microsoft.com/en-us/azure/data-factory/credentials?tabs=data-factory

使用 Azure 门户、SDK、PowerShell、REST API 将用户分配的托管标识关联到数据工厂实例。

我对 PowerShell 或 REST API 选项感兴趣,该过程需要自动化。

我在文档 https://learn.microsoft.com/en-us/powershell/module/az.datafactory/new-azdatafactoryv2linkedserviceencryptedcredential?view=azps-8.1.0 中找到了 New-AzDataFactoryV2LinkedServiceEncryptedCredential,但它不符合我的要求。

有没有人有 PowerShell 代码或 REST API 端点的示例来向 Azure 数据工厂添加凭据?

编辑: 我指的是这个凭据:

【问题讨论】:

  • 当前状态:微软支持确认没有文档,我们正在安排电话。

标签: azure azure-data-factory-2


【解决方案1】:

请按照以下参考进行详细说明:

使用 Powershell 和 REST API 在 Azure 数据工厂中创建凭据。

参考:

Azure Data Factory Using PowerShell by Dhilasu reddy

Managed identity for Azure Data Factory and Azure Synapse | Microsoft

【讨论】:

  • 不幸的是,这些链接没有帮助。我已经编辑了原始帖子。我已将屏幕截图添加到我所指的凭据中。
【解决方案2】:

我看不到任何支持 terraform 或 az cli 的东西,但是有一个 REST API。 https://learn.microsoft.com/en-us/rest/api/datafactory/credential-operations

然后,您可以将其与 az cli rest 调用一起使用,例如

$data_factory_name="my-data-factory"
$resource_group_name="my-resource-group"
$subscription_id=$(az account show --query "id")
$mi_name="my-user-managed-identity"
$credential_name="$mi_name"

$mi_id=$(az identity show --name $mi_name --subscription $subscription_id --resource-group $resource_group_name --query "id" -o tsv)

$url="https://management.azure.com/subscriptions/$subscription_id/resourceGroups/$resource_group_name/providers/Microsoft.DataFactory/factories/$data_factory_name/credentials/$credential_name`?api-version=2018-06-01"

$body=[PSCustomObject]@{
  properties = @{
    "type" = "ManagedIdentity"
    "typeProperties" = @{
      "resourceId" = $mi_id
    }
  }
}
$bodyJson = $body | ConvertTo-Json -Compress -Depth 100
$bodyJson = $bodyJson -replace "`"", "`""

az rest --method put --url $url --body $bodyJson

【讨论】:

    猜你喜欢
    • 2020-06-23
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    • 1970-01-01
    • 2022-01-13
    • 2020-01-14
    • 2020-11-20
    • 2020-04-16
    相关资源
    最近更新 更多