This blog explains how to resolve Azure DevOps pipeline failure when running dotnet ef migration update command.
Cannot open server 'demo-sql' requested by the login. Client with IP address 'xxx.xxx.xxx.xxx' is not allowed to access the server. To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect.
Reason for the failure.
The Azure SQL server has been created with public access limited to selected networks and Ip addresses, which means, only whitelisted networks and IPs allowed to access the SQL server. But Azure DevOps pipeline randomly picks Azure DevOps hosted agent which is not whitelisted in the SQL server.
Solution.
Go to network section of Azure SQL server. Select the check box in the exception section to allow Azure services and resources to access this server. This option allows firewall to allow connections from IPs of Azure services (Microsoft hosted agent for Azure pipelines are also belongs to Azure services).
Retry the pipeline and you would be able to see, deployment is successful.
No comments:
Post a Comment