azure - 为有问题的 azure databrick 添加 key 保管库范围

标签 azure powershell azure-keyvault azure-databricks

我正在尝试自动为 Azure DataBricks 服务添加 Keyvault 范围。

尝试使用 here 中的示例

代码

$Region = "southindia"
$ResID = "/subscriptions/*******/resourceGroups/******/providers/Microsoft.KeyVault/vaults/testkv123d"
$databricsOrgId = **********


Connect-Databricks -Region $Region -DatabricksOrgId $databricsOrgId `
    -ApplicationId ************ `
    -Secret ************ -TenantId ************  -Verbose

Connect-Databricks -Region $Region -ApplicationId ************** `
            -Secret ****************** `
            -ResourceGroupName ******* `
            -SubscriptionId ****************************** `
            -WorkspaceName *********** `
            -TenantId ********** -Verbose

Add-DatabricksSecretScope -ScopeName "kvscope" -Verbose -KeyVaultResourceId $ResID

问题详细信息

VERBOSE: POST https://southindia.azuredatabricks.net/api/2.0/secrets/scopes/create with -1-byte payload
Invoke-RestMethod : {"error_code":"INTERNAL_ERROR","message":"There was an internal error handling request POST to /api/2.0/secrets/scopes/create. Please try again later."}
At C:\Program Files\WindowsPowerShell\Modules\azure.databricks.cicd.tools\2.0.55\Public\Add-DatabricksSecretScope.ps1:73 char:9
+         Invoke-RestMethod -Method Post -Body $BodyText -Uri "$global: ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

最佳答案

根据我的研究,我们无法使用 REST API 创建 Azure Key Vault 支持的范围。我们只需在 Azure Databricks UI 中创建它即可。换句话说,如果我们在调用 REST API 或 CLI 时提供 key 保管库资源 id,则后端服务器无法处理该 api。更多详情请引用document enter image description here

因此,如果您使用 PowerShell 模块创建 secret 范围,则只需创建 Databricks-backed scopes .

例如 1.Create a new Service Principal此外,请注意,使用 Azure 门户中的访问控制 (IAM) Blade 将服务主体设为 Databricks 工作区的贡献者。*

  • 脚本
  • $region="your workspace region"
    Connect-Databricks -Region $region -ApplicationId "<sp app id>" -Secret "<sp client secret>" `
                -ResourceGroupName "<  resource group name >" `
                -SubscriptionId "<subscription id>" `
                -WorkspaceName "<workspace  name>" `
                -TenantId "<your tenant id>"
    $token = New-DatabricksBearerToken -LifetimeSeconds 3600 -Comment "Secret Scope Creation"
    Add-DatabricksSecretScope -Bearer $token.token_value -Region $region -ScopeName "test11"  -AllUserAccess 
    Get-DatabricksSecretScopes -Region $region -ScopeName "test11"
    

    enter image description here

    关于azure - 为有问题的 azure databrick 添加 key 保管库范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59840287/

    相关文章:

    java - 带 Spring 启动的 Keyvault MSI : How to config keyvault to use Azure cli credentials instead of managed identity while running on local?

    c# - 具有存储输入绑定(bind)错误的 HTTP 触发函数

    asp.net - 在 azure blob 存储中生成 ZIP 文件

    azure - Azure DevOps 中的 Cypress 自动化项目

    arrays - 在两个数组之间匹配值并排列在新数组中

    windows - 在 PowerShell 中重置 session

    azure - Azure 耐用实体的大小限制是多少

    excel - 如何在未安装 Excel 的情况下使用 Powershell 将 .xls 转换为 .csv

    java - 如何使用服务到服务身份验证来使用 Java 进行 Azure Key Vault 的本地开发?

    c# - 建议使用 webapplicationbuilder.configuration 而不是 configureappconfiguration