我正在尝试运行 SQL 脚本,通过指定带有令牌Azure SQL Database
的连接字符串来创建使用任务 Azure SQL 数据库部署的用户角色。JWT
从 Microsoft 文档中,我尝试了 DevOps 任务中的语法,但它抛出了错误。
string ConnectionString =@"Data Source=n9lxnyuzhv.database.windows.net; Initial Catalog=testdb;" SqlConnection conn = new SqlConnection(ConnectionString); conn.AccessToken = "Your JWT token" conn.Open();
错误
##[error]Invalid
keyword, contain one or more of 'no characters', 'control characters', 'leading or trailing whitespace' or 'leading semicolons'.
Please find the Steps followed
Created service principle in azure ad.
Granted directory consent.
Added the service principle to a AD GROUP.
Added that group as the ACTIVE DIRECTORY ADMIN in sql server so that all the members of the group can login using single sign on.
现在我需要为不在 admin 组中的其他用户提供访问权限,因此尝试添加包含的用户,我通过运行 create user query 实现了这一点。
但我需要自动化它,所以为了自动化,SQL 部署任务下有 4 个选项,它们是 1.sql 密码身份验证 2.活动目录集成 3.活动目录密码 4.连接字符串
我想要实现的是通过为服务主体生成 JWT 令牌来通过连接字符串。
但由于某种原因,它的失败可以帮助我在 Azure DevOps Pipeline 的 SQL 部署任务中提供带有 JWT TOKEN TO RUN 的连接字符串的确切语法。