首页 > 解决方案 > Azure devops 任务 AddOrUpdateUserAzure@1 失败 ubuntu-latest 托管代理

问题描述

在 Azure 管道中使用 AddOrUpdateUserAzure@1 任务使用 Microsoft 托管的代理ubuntu-latest创建 Microsoft SQL Server 数据库用户失败,并显示如下错误:

  - task: AddOrUpdateUserAzure@1
displayName: DB user creation
inputs:
  ConnectedServiceNameSelector: 'ConnectedServiceNameARM'
  ConnectedServiceNameARM: ${{ parameters.arm_service_connection }}
  serverName: test-sql-server'
  databaseName: 'test-sql-db'
  userName: 'admin'
  userPassword: 'admin_password'
  targetUserName: 'readonly-user'
  targetUserPassword: 'password'
  queryTimeout: '30'

错误

[错误] 当前操作系统无法运行此任务。这通常意味着该任务仅针对 Windows 编写。例如,为 Windows 桌面 PowerShell 编写。

请分享您的建议,我们可以使用 linux 代理在 Microsoft SQL Server 中创建只读用户

标签: azure-devopsazure-sql-databaseazure-pipelinesazure-pipelines-yamlazure-pipelines-tasks

解决方案


此问题是由Azure Powershell 版本引起的。

在此处输入图像描述

我建议您尝试其他版本的powershell。尝试 Azure PowerShell 任务版本 4.157.4。

请参阅此 github 链接 - https://github.com/microsoft/azure-pipelines-tasks/issues/11283


推荐阅读