我正在尝试使用应该运行 powershell 脚本的 yml 管道部署 databrick 工作区。
这是我的职责:
function Create-Databricks {
param (
[string] $rgName,
[string] $dbName
)
az extension add --name databricks
az databricks workspace create --resource-group $rgName --name $dbName --location
westeurope --output none
}
这是我的 for every 循环,它必须创建多个资源组和它们自己的数据块工作区
foreach ($key in $iniContent["trainees"].Keys) {
# Get the trainee name
$traineeName = $iniContent["trainees"][$key]
# Set Azure context
# az account set --subscription "721fd46a-a810-4202-aa25-8b58b0410e1b"
$names = $traineeName -split ' '
$lastname = ($traineeName -split ' ')[1].Substring(0, [Math]::Min(5,
$traineeName.IndexOf(" "))).ToLower()
# RG name
$resourceGroupName = "rg-academy-databricks-$lastname"
# SA name
$storageName = "stacademy$lastname"
# DB name
$databricksName = "dbs-academy-course-$lastname-001"
$accessconnectorName = "dbscon-academy-course-$lastname-001"
....
# Check if Databricks workspace exists
$dbExists = Get-AzDataBricksWorkspace -ResourceGroupName $resourceGroupName -Name
$databricksName -ErrorAction SilentlyContinue
if (-not $dbExists) {
Write-Output "Databricks workspace $databricksName does not exist. Creating..."
# Call function to create Databricks workspace if it doesn't exist
Create-Databricks -rgName $resourceGroupName -dbName $databricksName -tags $tags
}
else {
Write-Output "Databricks workspace $databricksName already exists. Skipping
creation."
}
}
它正在成功创建第一个交互并部署资源组、存储帐户和 databricks 工作区。但是当它进入第二次迭代时,它会执行除 databricks 工作区之外的所有操作并抛出此错误
警告:默认启用,包括扩展的预览版本 现在安装。于 2024 年 5 月禁用。使用“--allow-preview true” 如果需要的话专门启用它。使用“--allow-preview false”来 仅安装稳定版本。
警告:扩展“databricks”0.10.2 已安装。
错误:命令因意外错误而失败。这里是 追溯:
错误:_ModuleLock('msrest.exceptions') 检测到死锁 2811310367824
回溯(最近一次调用最后一次):
文件 “D:_work\s uild_scripts\windows rtifact