This commit is contained in:
fabiohaifa 2022-02-10 14:39:07 -03:00
Родитель 9453c3e86d
Коммит af86f431c8
2 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -453,7 +453,9 @@ You should to change `Key Valt Name` with your information and execute this scri
```
./DatabricksScopeCreation.ps1 `
-KeyVaultName "<kv_name>" `
-KeyVaultName "<keyvault_name>",
-ComputeResourceGroup "<compute_resource_group>",
-DatabricksName "<databricks_name>" `
```
>**Note**: To see Key names in secret scope dataops execute the follow command.

Просмотреть файл

@ -1,15 +1,21 @@
param(
[Parameter(Mandatory)] [string] $KeyVaultName
[Parameter(Mandatory)] [string] $KeyVaultName,
[Parameter(Mandatory)] [string] $ComputeResourceGroup,
[Parameter(Mandatory)] [string] $DatabricksName
)
Write-Host "Installing Databricks Cli..." -ForegroundColor Green
pip install databricks-cli --upgrade
Write-Host "Getting Azure resources..." -ForegroundColor Green
$kv = Get-AzKeyVault -VaultName $KeyVaultName
$dbw = Get-AzDatabricksWorkspace -ResourceGroupName $ComputeResourceGroup -Name $DatabricksName
Write-Host "Creating the Key Vault secret scope on Databricks..." -ForegroundColor Green
$accessToken = Get-AzAccessToken -ResourceUrl 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d
$env:DATABRICKS_TOKEN = $accessToken.Token
$env:DATABRICKS_HOST = "https://$($dbw.Url)"
Write-Host "URL DBW https://$($dbw.Url)"
#$env:DATABRICKS_HOST = "https://$($dbw.Url)"
#Write-Host "URL DBW https://$($dbw.Url)"
$scopesList = databricks secrets list-scopes --output json | ConvertFrom-Json
if (! $scopesList.scopes.name -contains "dataops") {
databricks secrets create-scope --scope 'dataops' --scope-backend-type AZURE_KEYVAULT --resource-id $kv.ResourceId --dns-name $kv.VaultUri