microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.49k stars 2.61k forks source link

Azure Sql Database Deployment - Firewall AutoDetect not working #6434

Closed bwinkler-dg closed 6 years ago

bwinkler-dg commented 6 years ago

Environment

VSTS, Hosted Agent, Azure Sql Database Deployment Task Version 1.1.25

Issue Description

We have an Azure SQL Server with "Allow access to Azure services" set to false in the firewall configuration. We use an Azure Sql Database Deployment Task to deploy a DACPAC package. Task options for Firewall are set to AutoDetect and Delete Rule After Task Ends. Deployment fails with the error down below. If we change the firewall setting in Azure to "Allow accesss to Azure services" = true, the task runs successfully.

The Get-AgentIPRange function in the Utility.ps1 tries to connect to the Sql Server and in case of an error parses the error message for an IP address, to allow this IP in the firewall. Running the task with verbose logging, no error is logged. The last log message from this function is "Reaching SqlServer to check connection by running sqlcmd.exe $sqlCmdArgs", after that an empty line is logged which might be "Write-Verbose ($ipAddressRange | Format-List | Out-String)" from the DeploySqlAzure.ps1.

2018-02-14T10:30:33.6199436Z ##[debug]Reaching SqlServer to check connection by running sqlcmd.exe -S "XXX.database.windows.net" -U "****" -Q "select getdate()" 2018-02-14T10:30:33.9219749Z ##[debug] 2018-02-14T10:30:33.9599350Z ##[debug]sqlPackageArguments = /SourceFile:"D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac" /Action:Publish /TargetServerName:"XXX.database.windows.net" /TargetDatabaseName:"XXX" /TargetUser:"****" /TargetPassword:"****" /TargetTimeout:120

Error logs

Full task output in debug mode:

2018-02-14T10:30:30.2508590Z ##[debug]Evaluating condition for step: 'Deploy PSS Database' 2018-02-14T10:30:30.2509585Z ##[debug]Evaluating: succeeded() 2018-02-14T10:30:30.2510106Z ##[debug]Evaluating succeeded: 2018-02-14T10:30:30.2510868Z ##[debug]=> (Boolean) True 2018-02-14T10:30:30.2511477Z ##[debug]Expanded: True 2018-02-14T10:30:30.2512028Z ##[debug]Result: True 2018-02-14T10:30:30.2512619Z ##[section]Starting: Deploy PSS Database 2018-02-14T10:30:30.2517873Z ============================================================================== 2018-02-14T10:30:30.2518381Z Task : Azure SQL Database Deployment 2018-02-14T10:30:30.2518830Z Description : Deploy Azure SQL DB using DACPAC or run scripts using SQLCMD 2018-02-14T10:30:30.2519240Z Version : 1.1.25 2018-02-14T10:30:30.2519691Z Author : Microsoft Corporation 2018-02-14T10:30:30.2520123Z Help : More Information 2018-02-14T10:30:30.2520610Z ============================================================================== 2018-02-14T10:30:31.6892917Z ##[debug]VstsTaskSdk 0.8.2 commit 2018-02-14T10:30:32.1702269Z ##[debug]Entering D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1. 2018-02-14T10:30:32.2032235Z ##[debug]INPUT_CONNECTEDSERVICENAMESELECTOR: 'ConnectedServiceNameARM' 2018-02-14T10:30:32.2059376Z ##[debug]INPUT_TASKNAMESELECTOR: 'DacpacTask' 2018-02-14T10:30:32.2099364Z ##[debug]INPUT_DACPACFILE: 'D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac' 2018-02-14T10:30:32.2121018Z ##[debug]INPUT_SQLFILE: 'D:\a\r1\a' 2018-02-14T10:30:32.2151138Z ##[debug]INPUT_SQLINLINE (empty) 2018-02-14T10:30:32.2176194Z ##[debug]INPUT_SERVERNAME: 'XXX.database.windows.net' 2018-02-14T10:30:32.2236231Z ##[debug]INPUT_DATABASENAME: 'XXX' 2018-02-14T10:30:32.2237183Z ##[debug]INPUT_CONNECTEDSERVICENAME (empty) 2018-02-14T10:30:32.2246499Z ##[debug]INPUT_CONNECTEDSERVICENAMEARM: 'cd93b2e5-4534-4bed-8241-bcb52678a0f3' 2018-02-14T10:30:32.2271142Z ##[debug]INPUT_SQLUSERNAME: '****' 2018-02-14T10:30:32.2293369Z ##[debug]INPUT_SQLPASSWORD: '****' 2018-02-14T10:30:32.2316566Z ##[debug]INPUT_PUBLISHPROFILE: 'D:\a\r1\a' 2018-02-14T10:30:32.2341956Z ##[debug]INPUT_ADDITIONALARGUMENTS (empty) 2018-02-14T10:30:32.2366898Z ##[debug]INPUT_SQLADDITIONALARGUMENTS (empty) 2018-02-14T10:30:32.2392560Z ##[debug]INPUT_INLINEADDITIONALARGUMENTS (empty) 2018-02-14T10:30:32.2417710Z ##[debug]INPUT_IPDETECTIONMETHOD: 'AutoDetect' 2018-02-14T10:30:32.2443798Z ##[debug]INPUT_STARTIPADDRESS (empty) 2018-02-14T10:30:32.2469670Z ##[debug]INPUT_ENDIPADDRESS (empty) 2018-02-14T10:30:32.2495678Z ##[debug]INPUT_DELETEFIREWALLRULE: 'true' 2018-02-14T10:30:32.2525774Z ##[debug] Converted to bool: True 2018-02-14T10:30:32.2552528Z ##[debug]Loading module from path 'D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\psmodules\VstsAzureRestHelpers\VstsAzureRestHelpers_.psm1'. 2018-02-14T10:30:32.2696199Z ##[debug]$OVERRIDING $global:DebugPreference from 'Continue' to 'SilentlyContinue'. 2018-02-14T10:30:32.2721612Z ##[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\psmodules\VstsAzureRestHelpers/module.json 2018-02-14T10:30:32.2936364Z ##[debug]Loaded 7 strings. 2018-02-14T10:30:32.2983378Z ##[debug]SYSTEM_CULTURE: 'en-US' 2018-02-14T10:30:32.3007696Z ##[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\psmodules\VstsAzureRestHelpers\Strings\resources.resjson\en-US\resources.resjson 2018-02-14T10:30:32.3228344Z ##[debug]Loaded 7 strings. 2018-02-14T10:30:32.3229431Z ##[debug]Exporting function 'Add-AzureSqlDatabaseServerFirewallRule'. 2018-02-14T10:30:32.3237745Z ##[debug]Exporting function 'Remove-AzureSqlDatabaseServerFirewallRule'. 2018-02-14T10:30:32.3255862Z ##[debug]Exporting function 'Get-AzStorageKeys'. 2018-02-14T10:30:32.4542436Z ##[debug]Exporting function 'Get-AzRMStorageKeys'. 2018-02-14T10:30:32.4584208Z ##[debug]Exporting function 'Get-AzRmVmCustomScriptExtension'. 2018-02-14T10:30:32.4605723Z ##[debug]Exporting function 'Remove-AzRmVmCustomScriptExtension'. 2018-02-14T10:30:32.4609612Z ##[debug]Exporting function 'Get-AzStorageAccount'. 2018-02-14T10:30:32.4630615Z ##[debug]Exporting function 'Get-AzRmStorageAccount'. 2018-02-14T10:30:32.4647219Z ##[debug]Exporting function 'Get-AzRmResourceGroup'. 2018-02-14T10:30:32.4665769Z ##[debug]Exporting function 'Get-AzureNetworkInterfaceDetails'. 2018-02-14T10:30:32.4682704Z ##[debug]Exporting function 'Get-AzurePublicIpAddressDetails'. 2018-02-14T10:30:32.4702857Z ##[debug]Exporting function 'Get-AzureLoadBalancersDetails'. 2018-02-14T10:30:32.4721340Z ##[debug]Exporting function 'Get-AzureLoadBalancerDetails'. 2018-02-14T10:30:32.4737955Z ##[debug]Exporting function 'Get-AzureRMLoadBalancerFrontendIpConfigDetails'. 2018-02-14T10:30:32.4755557Z ##[debug]Exporting function 'Get-AzureRMLoadBalancerInboundNatRuleConfigDetails'. 2018-02-14T10:30:32.4772373Z ##[debug]Importing function 'Add-AzureSqlDatabaseServerFirewallRule'. 2018-02-14T10:30:32.4789707Z ##[debug]Importing function 'Get-AzRmResourceGroup'. 2018-02-14T10:30:32.4805304Z ##[debug]Importing function 'Get-AzRmStorageAccount'. 2018-02-14T10:30:32.4822415Z ##[debug]Importing function 'Get-AzRMStorageKeys'. 2018-02-14T10:30:32.4837560Z ##[debug]Importing function 'Get-AzRmVmCustomScriptExtension'. 2018-02-14T10:30:32.4855234Z ##[debug]Importing function 'Get-AzStorageAccount'. 2018-02-14T10:30:32.4871157Z ##[debug]Importing function 'Get-AzStorageKeys'. 2018-02-14T10:30:32.4887740Z ##[debug]Importing function 'Get-AzureLoadBalancerDetails'. 2018-02-14T10:30:32.4903988Z ##[debug]Importing function 'Get-AzureLoadBalancersDetails'. 2018-02-14T10:30:32.4921289Z ##[debug]Importing function 'Get-AzureNetworkInterfaceDetails'. 2018-02-14T10:30:32.4938654Z ##[debug]Importing function 'Get-AzurePublicIpAddressDetails'. 2018-02-14T10:30:32.4954268Z ##[debug]Importing function 'Get-AzureRMLoadBalancerFrontendIpConfigDetails'. 2018-02-14T10:30:32.4971908Z ##[debug]Importing function 'Get-AzureRMLoadBalancerInboundNatRuleConfigDetails'. 2018-02-14T10:30:32.4987298Z ##[debug]Importing function 'Remove-AzRmVmCustomScriptExtension'. 2018-02-14T10:30:32.5004569Z ##[debug]Importing function 'Remove-AzureSqlDatabaseServerFirewallRule'. 2018-02-14T10:30:32.5028334Z ##[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25/Task.json 2018-02-14T10:30:32.5505184Z ##[debug]Loaded 11 strings. 2018-02-14T10:30:32.5534893Z ##[debug]SYSTEM_CULTURE: 'en-US' 2018-02-14T10:30:32.5555073Z ##[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\Strings\resources.resjson\en-US\resources.resjson 2018-02-14T10:30:32.5834081Z ##[debug]Loaded 11 strings. 2018-02-14T10:30:32.5988507Z ##[debug]FilePath= Find-VstsFiles LegacyPattern D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac 2018-02-14T10:30:32.6150288Z ##[debug]Entering Find-VstsFiles. 2018-02-14T10:30:32.6269994Z ##[debug] LiteralDirectory: 'LegacyPattern' 2018-02-14T10:30:32.6287112Z ##[debug] LegacyPattern: 'D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac' 2018-02-14T10:30:33.0249229Z ##[debug]Entering Get-MatchingItems. 2018-02-14T10:30:33.0282654Z ##[debug] IncludePatterns: 'D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac' 2018-02-14T10:30:33.0340697Z ##[debug] ExcludePatterns: '' 2018-02-14T10:30:33.0383341Z ##[debug] IncludeFiles: 'True' 2018-02-14T10:30:33.0401789Z ##[debug] IncludeDirectories: 'False' 2018-02-14T10:30:33.0419248Z ##[debug] Force: 'False' 2018-02-14T10:30:33.6036416Z ##[debug]Path: D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac 2018-02-14T10:30:33.6039259Z ##[debug]Leaving Get-MatchingItems. 2018-02-14T10:30:33.6125264Z ##[debug]Total found: 1 2018-02-14T10:30:33.6126398Z ##[debug]Leaving Find-VstsFiles. 2018-02-14T10:30:33.6128140Z packageFile= D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac 2018-02-14T10:30:33.6129041Z ##[debug]Server friendly name is XXX 2018-02-14T10:30:33.6129894Z ##[debug]ENDPOINT_URL_cd93b2e5-4534-4bed-8241-bcb52678a0f3: 'https://management.azure.com/' 2018-02-14T10:30:33.6130768Z ##[debug]ENDPOINT_AUTH_cd93b2e5-4534-4bed-8241-bcb52678a0f3: '****' 2018-02-14T10:30:33.6133113Z ##[debug]ENDPOINT_DATA_cd93b2e5-4534-4bed-8241-bcb52678a0f3: '{"subscriptionId":"XXX","subscriptionName":"XXX","azureSpnRoleAssignmentId":"","azureSpnPermissions":"","spnObjectId":"","appObjectId":"","creationMode":"Manual","environment":"AzureCloud","environmentUrl":"https://management.azure.com/","galleryUrl":"https://gallery.azure.com/","serviceManagementUrl":"https://management.core.windows.net/","resourceManagerUrl":"https://management.azure.com/","activeDirectoryAuthority":"https://login.microsoftonline.com/","environmentAuthorityUrl":"https://login.windows.net/","graphUrl":"https://graph.windows.net/","managementPortalUrl":"https://manage.windowsazure.com/","armManagementPortalUrl":"https://portal.azure.com/","activeDirectoryServiceEndpointResourceId":"https://management.core.windows.net/","sqlDatabaseDnsSuffix":".database.windows.net","AzureKeyVaultDnsSuffix":"vault.azure.net","AzureKeyVaultServiceEndpointResourceId":"https://vault.azure.net","StorageEndpointSuffix":"core.windows.net"}' 2018-02-14T10:30:33.6199436Z ##[debug]Reaching SqlServer to check connection by running sqlcmd.exe -S "XXX.database.windows.net" -U "****" -Q "select getdate()" 2018-02-14T10:30:33.9219749Z ##[debug] 2018-02-14T10:30:33.9599350Z ##[debug]sqlPackageArguments = /SourceFile:"D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac" /Action:Publish /TargetServerName:"XXX.database.windows.net" /TargetDatabaseName:"XXX" /TargetUser:"****" /TargetPassword:"****" /TargetTimeout:120 2018-02-14T10:30:34.2243277Z ##[debug]Sql Versions installed on machine factoryvm-az443 as read from registry: 140 130 120 110 2018-02-14T10:30:34.3061357Z ##[debug]Sql Version Specific Root Dir for version 140 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\140\ 2018-02-14T10:30:34.3105372Z ##[debug]Sql Version Specific Root Dir for version 130 as read from registry: C:\Program Files\Microsoft SQL Server\130\ 2018-02-14T10:30:34.3127465Z ##[debug]Sql Version Specific Root Dir for version 130 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\130\ 2018-02-14T10:30:34.3152530Z ##[debug]Sql Version Specific Root Dir for version 120 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\120\ 2018-02-14T10:30:34.3177429Z ##[debug]Sql Version Specific Root Dir for version 110 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\110\ 2018-02-14T10:30:34.3195809Z ##[debug]Dac Framework (installed with SQL) not found on machine factoryvm-az443 2018-02-14T10:30:34.3617907Z ##[debug]Dac Framework installed with SQL Version 140 found at C:\Program Files\Microsoft SQL Server\140\DAC\bin\SqlPackage.exe on machine factoryvm-az443 2018-02-14T10:30:34.3709072Z ##[debug]Getting latest Visual Studio 15 setup instance. 2018-02-14T10:30:34.4906544Z ##[debug]Entering Invoke-VstsTool. 2018-02-14T10:30:34.4922272Z ##[debug] FileName: 'D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\vswhere.exe' 2018-02-14T10:30:34.4938009Z ##[debug] Arguments: '-version [15.0,16.0) -latest -format json' 2018-02-14T10:30:34.4953415Z ##[debug] RequireExitCodeZero: 'True' 2018-02-14T10:30:34.4975584Z ##[command]"D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\vswhere.exe" -version [15.0,16.0) -latest -format json 2018-02-14T10:30:34.5615269Z ##[debug][ 2018-02-14T10:30:34.5658827Z ##[debug] { 2018-02-14T10:30:34.5676694Z ##[debug] "instanceId": "d3d708c4", 2018-02-14T10:30:34.5692981Z ##[debug] "installDate": "2018-01-30T11:00:38Z", 2018-02-14T10:30:34.5709092Z ##[debug] "installationName": "VisualStudio/15.5.6+27130.2027", 2018-02-14T10:30:34.5725902Z ##[debug] "installationPath": "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise", 2018-02-14T10:30:34.5742434Z ##[debug] "installationVersion": "15.5.27130.2027", 2018-02-14T10:30:34.5759452Z ##[debug] "displayName": "Visual Studio Enterprise 2017", 2018-02-14T10:30:34.5775631Z ##[debug] "description": "Microsoft DevOps solution for productivity and coordination across teams of any size", 2018-02-14T10:30:34.5792446Z ##[debug] "enginePath": "C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service", 2018-02-14T10:30:34.5827327Z ##[debug] "channelId": "VisualStudio.15.Release", 2018-02-14T10:30:34.5844142Z ##[debug] "channelPath": "C:\Users\installer\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\4CB340F5\catalog.json", 2018-02-14T10:30:34.5859688Z ##[debug] "channelUri": "https://aka.ms/vs/15/release/channel", 2018-02-14T10:30:34.5876286Z ##[debug] "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.5.6", 2018-02-14T10:30:34.5892341Z ##[debug] "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708" 2018-02-14T10:30:34.5907790Z ##[debug] } 2018-02-14T10:30:34.5924655Z ##[debug]] 2018-02-14T10:30:34.5941014Z ##[debug]Exit code: 0 2018-02-14T10:30:34.5959921Z ##[debug]Leaving Invoke-VstsTool. 2018-02-14T10:30:34.6477117Z ##[debug]Dac Framework installed with Visual Studio found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\SqlPackage.exe on machine factoryvm-az443 2018-02-14T10:30:34.6503632Z ##[debug]Executing SQLPackage.exe 2018-02-14T10:30:34.6521548Z ##[debug]Executing : "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\SqlPackage.exe" /SourceFile:"D:\a\r1\a\CloudOrchestrationDatabase\drop\CloudOrchestration.dacpac" /Action:Publish /TargetServerName:"XXX.database.windows.net" /TargetDatabaseName:"XXX" /TargetUser:"****" /TargetPassword:"****" /TargetTimeout:120 2018-02-14T10:30:37.2833295Z Publishing to database 'XXX' on server 'XXX.database.windows.net'. 2018-02-14T10:30:40.2984550Z Initializing deployment (Start) 2018-02-14T10:30:44.4599124Z Initializing deployment (Failed) 2018-02-14T10:30:44.4812478Z ##[debug]Error record: 2018-02-14T10:30:44.5667665Z ##[debug]Execute-Command : An error occurred during deployment plan generation. Deployment cannot continue. 2018-02-14T10:30:44.5678202Z ##[debug]At D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1:178 char:9 2018-02-14T10:30:44.5687450Z ##[debug]+ Execute-Command -FileName $SqlPackagePath -Arguments $scriptA ... 2018-02-14T10:30:44.5697188Z ##[debug]+ ~~~~~~~~~~~~~ 2018-02-14T10:30:44.5707454Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException 2018-02-14T10:30:44.6308574Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Execute-Command 2018-02-14T10:30:44.6332016Z ##[debug] 2018-02-14T10:30:44.6333183Z ##[debug]Script stack trace: 2018-02-14T10:30:44.6367768Z ##[debug]at Execute-Command, D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\Utility.ps1: line 235 2018-02-14T10:30:44.6377294Z ##[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1: line 178 2018-02-14T10:30:44.6387189Z ##[debug]at , : line 1 2018-02-14T10:30:44.6397369Z ##[debug]at , : line 22 2018-02-14T10:30:44.6409738Z ##[debug]at , : line 18 2018-02-14T10:30:44.6422353Z ##[debug]at , : line 1 2018-02-14T10:30:44.6438315Z ##[debug]Exception: 2018-02-14T10:30:44.6473169Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: An error occurred during deployment plan generation. Deployment cannot continue. 2018-02-14T10:30:44.6683460Z ##[error] An error occurred during deployment plan generation. Deployment cannot continue. 2018-02-14T10:30:44.6684067Z ##[debug]Processed: ##vso[task.logissue type=error] An error occurred during deployment plan generation. Deployment cannot continue. 2018-02-14T10:30:44.6700007Z ##[debug]Error record: 2018-02-14T10:30:44.6773152Z ##[debug]Execute-Command : Could not connect to XXX.database.windows.net XXX: Cannot open server 'XXX' requested by the login. Client with IP address '40.69.20 2018-02-14T10:30:44.6782585Z ##[debug]At D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1:178 char:9 2018-02-14T10:30:44.6794382Z ##[debug]+ Execute-Command -FileName $SqlPackagePath -Arguments $scriptA ... 2018-02-14T10:30:44.6803620Z ##[debug]+ ~~~~~~~~~~~~~ 2018-02-14T10:30:44.6813048Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException 2018-02-14T10:30:44.6823493Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Execute-Command 2018-02-14T10:30:44.6832154Z ##[debug] 2018-02-14T10:30:44.6847704Z ##[debug]Script stack trace: 2018-02-14T10:30:44.6864211Z ##[debug]at Execute-Command, D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\Utility.ps1: line 235 2018-02-14T10:30:44.6877442Z ##[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1: line 178 2018-02-14T10:30:44.6882055Z ##[debug]at , : line 1 2018-02-14T10:30:44.6893229Z ##[debug]at , : line 22 2018-02-14T10:30:44.6902343Z ##[debug]at , : line 18 2018-02-14T10:30:44.6913018Z ##[debug]at , : line 1 2018-02-14T10:30:44.6927827Z ##[debug]Exception: 2018-02-14T10:30:44.6944858Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: Could not connect to XXX.database.windows.net XXX: Cannot open server 'XXX' requested by the login. Client with IP address '40.69.20 2018-02-14T10:30:44.6959924Z ##[error]Could not connect to XXX.database.windows.net XXX: Cannot open server 'XXX' requested by the login. Client with IP address '40.69.20 2018-02-14T10:30:44.6960908Z ##[debug]Processed: ##vso[task.logissue type=error]Could not connect to XXX.database.windows.net XXX: Cannot open server 'XXX' requested by the login. Client with IP address '40.69.20 2018-02-14T10:30:44.6976111Z ##[debug]Error record: 2018-02-14T10:30:44.7037764Z ##[debug]Execute-Command : 5.182' 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. 2018-02-14T10:30:44.7048071Z ##[debug]Cannot open server 'XXX' requested by the login. Client with IP address '40.69.205.182' 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. 2018-02-14T10:30:44.7056615Z ##[debug] 2018-02-14T10:30:44.7066897Z ##[debug]At D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1:178 char:9 2018-02-14T10:30:44.7076114Z ##[debug]+ Execute-Command -FileName $SqlPackagePath -Arguments $scriptA ... 2018-02-14T10:30:44.7086741Z ##[debug]+ ~~~~~~~~~~~~~ 2018-02-14T10:30:44.7095981Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException 2018-02-14T10:30:44.7106175Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Execute-Command 2018-02-14T10:30:44.7115441Z ##[debug] 2018-02-14T10:30:44.7132433Z ##[debug]Script stack trace: 2018-02-14T10:30:44.7149540Z ##[debug]at Execute-Command, D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\Utility.ps1: line 235 2018-02-14T10:30:44.7158436Z ##[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1: line 178 2018-02-14T10:30:44.7168707Z ##[debug]at , : line 1 2018-02-14T10:30:44.7178146Z ##[debug]at , : line 22 2018-02-14T10:30:44.7188775Z ##[debug]at , : line 18 2018-02-14T10:30:44.7197986Z ##[debug]at , : line 1 2018-02-14T10:30:44.7214128Z ##[debug]Exception: 2018-02-14T10:30:44.7232467Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: 5.182' 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. 2018-02-14T10:30:44.7242534Z ##[debug]Cannot open server 'XXX' requested by the login. Client with IP address '40.69.205.182' 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. 2018-02-14T10:30:44.7251372Z ##[debug] 2018-02-14T10:30:44.7268687Z ##[error]5.182' 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. Cannot open server 'XXX' requested by the login. Client with IP address '40.69.205.182' 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.

2018-02-14T10:30:44.7271418Z ##[debug]Processed: ##vso[task.logissue type=error]5.182' 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.%0D%0ACannot open server 'XXX' requested by the login. Client with IP address '40.69.205.182' 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.%0D%0A 2018-02-14T10:30:44.9017264Z ##[debug]No Firewall Rule was added 2018-02-14T10:30:45.0647889Z ##[debug]Caught exception from task script. 2018-02-14T10:30:45.0665586Z ##[debug]Error record: 2018-02-14T10:30:45.0754684Z ##[debug]D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1 : Azure SQL Dacpac task failed. 2018-02-14T10:30:45.0764742Z ##[debug]At line:1 char:1 2018-02-14T10:30:45.0775084Z ##[debug]+ . 'D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a ... 2018-02-14T10:30:45.0785297Z ##[debug]+ ~~~~~~~~~~~~~~~~~ 2018-02-14T10:30:45.0795550Z ##[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException 2018-02-14T10:30:45.0805391Z ##[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,DeploySqlAzure.ps1 2018-02-14T10:30:45.0815372Z ##[debug] 2018-02-14T10:30:45.0831090Z ##[debug]Script stack trace: 2018-02-14T10:30:45.0848243Z ##[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.25\DeploySqlAzure.ps1: line 234 2018-02-14T10:30:45.0858421Z ##[debug]at , : line 1 2018-02-14T10:30:45.0868478Z ##[debug]at , : line 22 2018-02-14T10:30:45.0878545Z ##[debug]at , : line 18 2018-02-14T10:30:45.0888673Z ##[debug]at , : line 1 2018-02-14T10:30:45.0905412Z ##[debug]Exception: 2018-02-14T10:30:45.0921891Z ##[debug]Microsoft.PowerShell.Commands.WriteErrorException: Azure SQL Dacpac task failed. 2018-02-14T10:30:45.0937989Z ##[error]Azure SQL Dacpac task failed. 2018-02-14T10:30:45.0938487Z ##[debug]Processed: ##vso[task.logissue type=error]Azure SQL Dacpac task failed. 2018-02-14T10:30:45.0943230Z ##[debug]Processed: ##vso[task.complete result=Failed] 2018-02-14T10:30:45.1230663Z ##[section]Finishing: Deploy PSS Database

asranja commented 6 years ago

@bwinkler-dg Thanks for reaching out to us.

Looks like sqlcmd.exe is not properly throwing error on the Hosted agent. While we investigate this further and come up with a fix, you can unblock yourself by setting "Allow accesss to Azure services" = true in the Firewall rule in portal. This should work because Hosted Agents are Azure VMs and hence they will be able to pass the firewall.

bwinkler-dg commented 6 years ago

@asranja Thanks for the reply. Actually allowing all Azure services in the firewall is what we are trying to avoid. So we will have to enable it before we execute the task and disable it afterwards, until this issue is fixed. Keep up the good work!

Ajay-MS commented 6 years ago

@bwinkler-dg

We have fixed this issue. As deployment is in progress please check if the issue has been fixed for you and share your visual studio account name to let you know if the fix has been deployed to your account.

bwinkler-dg commented 6 years ago

@Ajay-MS Thank you for the fix and for the information. I just checked and the problem is not yet fixed in our account. I will test again during the next days.

Ajay-MS commented 6 years ago

@bwinkler-dg

Thanks for the update. Can you please share you VSTS account name so that I can check for approx time pending for the update for your account.

bwinkler-dg commented 6 years ago

@Ajay-MS

It is working in our tenant now. Issue can be closed. Thanks a lot.

Ajay-MS commented 6 years ago

@bwinkler-dg

Thanks for the confirmation for closure.