我有一个 Microsoft Fabric 仓库,并且我们在 Azure DevOps 中有几个脚本,我们的目标是通过 CI/CD 发布管道执行。我正在寻求有关在 Azure DevOps 和 Microsoft Fabric 中的发布管道之间建立连接的指导。此外,这是我们用来运行 Fabric 脚本的 PowerShell 脚本:
# Define authentication details for Azure Synapse SQL Data Warehouse
$userName = " xx"
$password = "yy"
# Define the Azure Synapse SQL Data Warehouse server name
$connectionString = " V7PULMP2UPRULHPJ3OYUMXKS7Y- ZDY7HCDTEL2EJLFT4SSIWSHTVA.datawarehouse.pbidedicated.windows.net"
$databaseName = "MSF warehouse"
# Loop through all files in the specified directory
$sqlFiles = Get-ChildItem -Path "$(System.DefaultWorkingDirectory)\_copy directory\build artifact\ELT\scripts"
foreach ($file in $sqlFiles) {
if ($file.Extension -eq ".sql") {
Write-Host ("Executing SQL file: " + $file.Name)
$sqlFilePath = $file.FullName
# Run the SQL script using SQLCMD (or use Invoke-Sqlcmd if available)
sqlcmd -S $connectionString -d $databaseName -U $userName -P $password -i $sqlFilePath
}
}
我还尝试使用服务主体和个人访问令牌,但没有成功。
我还尝试使用服务主体和个人访问令牌,但没有成功。
使用服务主体时是否有任何错误消息?
通过查看 Azure Synapse Analytics 中的文档 CI CD ,我建议您可以为资源组创建一个 Azure 资源管理器服务连接来连接 Synapse 数据仓库。
您可以检查以下步骤。
1.为资源组创建 Azure 资源管理器服务连接。
2.向我们的 Azure DevOps 服务主体授予对 Azure Synapse 工作区的访问权限。
3 添加
Azure PowerShell
任务并选择您在步骤 1 中创建的服务连接,然后编写您要运行的脚本,看看这是否适合您。
如有任何误解,请随时告诉我。