[英]Users are inactive/disabled with red “X” mark after solution deployment to Azure SQL Server database
[英]AzureDevOps - Azure SQL Server deployment Problems and Solution
部署 Azure SQL 服务器时遇到的众所周知的问题有哪些解决方案。
##[error]System.Management.Automation.ParentContainsErrorRecordException: *** Deployment cannot continueAn error occurred during deployment plan generation.
##[error]Publishing to database 'testdb' on server 'ajyatest.database.windows.net'. Initializing deployment (Start) Initializing deployment (Failed) *** Could not deploy package. Unable to connect to master or target server 'testdb'. You must have a user with the same password in master or target server 'testdb'.
##[error]System.Management.Automation.RuntimeException: No resource found with serverName ajyatest1, serverType Microsoft.Sql/servers in subscription <SubscriptionId>. Specify the correct serverName/serverType and try again.
Server name 'ajyatest1' is not in the right format. Use FQDN format like 'yyy.database.windows.net'
##[error]System.Net.WebException: The remote server returned an error: (404) Not Found.
##[error]Start IP address of firewall rule cannot exceed End IP address.
##[error]Invalid value provided for parameter: startIpAddress
##[error] Named pipes provider, error: 40 – could not open a connect to SQL.
Possible suggestions
如何为 SQLPackage.exe 配置超时?
托管代理是否支持使用 AAD 集成身份验证的 Azure SQL 数据库部署?
Azure SQL 数据库部署-导入的Invoke-Sqlcmd不支持connectionString
SqlPackage.exe 参数/p:BackupDatabaseBeforeChanges=true
在 Azure 上失败
Azure SQL 发布 - SQL 脚本文件 - 无法将秘密值作为变量传递
##[error]System.Management.Automation.ParentContainsErrorRecordException: *** Deployment cannot continueAn error occurred during deployment plan generation.
原因
您尝试部署 dacpac 的 SQL 服务器的目标平台与 dacpac 文件的目标平台不同。
可能的解决方案
添加 /p:AllowIncompatiblePlatform=true 参数作为 WinRm SQL 服务器任务的附加参数。
##[error]Publishing to database 'testdb' on server 'ajyatest.database.windows.net'. Initializing deployment (Start) Initializing deployment (Failed) *** Could not deploy package. Unable to connect to master or target server 'testdb'. You must have a user with the same password in master or target server 'testdb'.
原因
SQL 服务器的用户名或密码错误。
可能的解决方案
检查用户名和密码是否适合 SQL 服务器。 [您可以使用SSMS验证用户名密码]
##[error]System.Management.Automation.RuntimeException: No resource found with serverName ajyatest1, serverType Microsoft.Sql/servers in subscription <SubscriptionId>. Specify the correct serverName/serverType and try again.
原因
错误的 SQL 服务器名称是错误的。
可能的解决方案
检查 Azure 门户上是否存在同名的 SQL 服务器。
Server name 'ajyatest1' is not in the right format. Use FQDN format like 'yyy.database.windows.net'
原因
SQL server 作为输入未作为 FQDN 提供。
可能的解决方案
正如错误本身所提到的,以“yyy.database.windows.net”格式提供SQL服务器
##[error]System.Net.WebException: The remote server returned an error: (404) Not Found.
原因
检查端点 URL 以创建防火墙规则。 验证端点的 URL 是否是最新的。
可能的解决方案
检查端点有什么问题。 用户如何创建端点。
##[error]Start IP address of firewall rule cannot exceed End IP address.
原因
End IP 小于 Start IP 用于创建防火墙规则。
可能的解决方案
起始IP 的IP 地址应小于结束IP 地址。
##[error]Invalid value provided for parameter: startIpAddress
原因
IP 地址格式不正确。
可能的解决方案
起始IP 的IP 地址应小于结束IP 地址。
##[error] Named pipes provider, error: 40 – could not open a connect to SQL.
Possible suggestions
建议
对于 onPrem SQL 服务器 1. SQL 服务器名称应采用正确的格式 server\\instance。 2. 验证连接字符串。 3. 检查是否在 SQL 实例上启用了命名管道 (NP)。 4. 是否启用远程连接。
For Azure SQL server
1. 它可能会导致每个应用程序受到限制。 2. 尝试给出端口为 1433 的 azure SQL 服务器名称。例如 servername.database.windows.net,1433;
如何为 SQLPackage.exe 配置超时?
解决方案
/p:CommandTimeout=1200 /TargetTimeout: 1200
托管代理是否支持使用 AAD 集成身份验证的 Azure SQL 数据库部署?
解决方案
否,AAD 集成身份验证尝试使用运行代理的同一用户登录 SQL 服务器。 由于出于安全原因,托管代理用户在 SQL 服务器上没有权限。因此它将失败。 换言之,托管代理不支持 AAD 集成身份验证。 以为您可以使用 Active Directory - 密码身份验证。
Azure SQL 数据库部署 - 导入的 Invoke-Sqlcmd 不支持 connectionString
解决方案导入的 Invoke-Sqlcmd 不支持 connectionString。 安装 SQLServer PS 模块。
SqlPackage.exe 参数/p:BackupDatabaseBeforeChanges=true
在 Azure 上失败
解决方案
/p:BackupDatabaseBeforeChanges=true
选项适用于本地数据库。 该选项不适用于 Azure,因为备份系统完全不同。
Azure SQL 发布 - SQL 脚本文件 - 无法将机密值作为变量传递
解决方案
SQL 脚本文件支持秘密变量。 确保您按如下方式传递变量的参数。
Invoke-Sqlcmd -ServerInstance "test.database.windows.net" -Database "Testdb" -Username "test" -Password ****** -Inputfile "C:\test.sql" -variable "MYVAR1='$(variablevalue1)'", "MYVAR2='String2'" -ConnectionTimeout 120
SQLPackage.exe 参数的文档
为 SQLPackage.exe 配置诊断日志
/diagnostics:true
从任务中获取调试日志
将发布定义变量system.debug
设置为true
SqlCMD 参数
比较 SqlCmd 和 Invoke-SqlCmd 参数
问题3:
可能是您的数据库防火墙的问题
in your SQL database in the azure portal go to set server firewall and then add a new firewall rule with your client IP address will fix the issue.
警告:请记住添加 start: 0.0.0.0 end 255.255.255.255 将让每个人都可以访问数据库
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.