Publish database to Azure Gov using hosted build agent - mstest

We're using the hosted VSTS PAAS soluition for managing our source, tasks, and are incorporating the hosted build agent. We're able to successfully publish our app services to Azure Gov, but are having issues trying to accomplish two tasks in our build pipeline and suspect both are related.
We use the database projects to build a dacpac and the Execute Azure SQL build task to publish the schema changes to our databases. When targeting Azure Gov, we're unable to connect to the server with the following message:
Unable to connect to master or target server '{servername}'. You must have
a user with the same password in master or target server '{servername}'.
I've confirmed that my SQL DB Details are set correctly. I also tried setting the firewall rules both to AutoDetect and IP Range (of 0.0.0.0 - 255.255.255.255) but am still seeing the same error. I still suspect that the VS build agent is not able to set the firewall rule for azure gov tenant even though the step is configured to use an ARM Azure connection type that successfully connects to our subscription.
Update 12/11/2017:
Here is a modified log file from the build process:
##[section]Starting: Execute Azure SQL : DacpacTask
Task : Azure SQL Database Deployment
Description : Deploy Azure SQL DB using DACPAC or run scripts using SQLCMD
Version : 1.1.24
Author : Microsoft Corporation
Help : More Information
[debug]VstsTaskSdk 0.8.2 commit
[debug]Entering D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1.
[debug]INPUT_CONNECTEDSERVICENAMESELECTOR: 'ConnectedServiceNameARM'
[debug]INPUT_TASKNAMESELECTOR: 'DacpacTask'
[debug]INPUT_DACPACFILE: 'd:\a\1\s\src\Vics\bin\Release\Database.dacpac'
[debug]INPUT_SQLFILE: 'd:\a\1\s'
[debug]INPUT_SQLINLINE (empty)
[debug]INPUT_SERVERNAME: 'tcp:{server}.database.usgovcloudapi.net,1433'
[debug]INPUT_DATABASENAME: '{instance}'
[debug]INPUT_CONNECTEDSERVICENAME: '{ARM ID}'
[debug]INPUT_CONNECTEDSERVICENAMEARM: ''
[debug]INPUT_SQLUSERNAME: '{user}'
[debug]INPUT_SQLPASSWORD: '{pwd}'
[debug]INPUT_PUBLISHPROFILE: 'd:\a\1\s'
[debug]INPUT_ADDITIONALARGUMENTS: '/p:BlockOnPossibleDataLoss=False /p:AllowIncompatiblePlatform=True'
[debug]INPUT_SQLADDITIONALARGUMENTS (empty)
[debug]INPUT_INLINEADDITIONALARGUMENTS (empty)
[debug]INPUT_IPDETECTIONMETHOD: 'AutoDetect'
[debug]INPUT_STARTIPADDRESS (empty)
[debug]INPUT_ENDIPADDRESS (empty)
[debug]INPUT_DELETEFIREWALLRULE: 'true'
[debug] Converted to bool: True
[debug]Loading module from path 'D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\ps_modules\VstsAzureRestHelpers_\VstsAzureRestHelpers_.psm1'.
[debug]$OVERRIDING $global:DebugPreference from 'Continue' to 'SilentlyContinue'.
[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\ps_modules\VstsAzureRestHelpers_/module.json
[debug]Loaded 7 strings.
[debug]SYSTEM_CULTURE: 'en-US'
[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\ps_modules\VstsAzureRestHelpers_\Strings\resources.resjson\en-US\resources.resjson
[debug]Loaded 7 strings.
[debug]Exporting function 'Add-AzureSqlDatabaseServerFirewallRule'.
[debug]Exporting function 'Remove-AzureSqlDatabaseServerFirewallRule'.
[debug]Exporting function 'Get-AzStorageKeys'.
[debug]Exporting function 'Get-AzRMStorageKeys'.
[debug]Exporting function 'Get-AzRmVmCustomScriptExtension'.
[debug]Exporting function 'Remove-AzRmVmCustomScriptExtension'.
[debug]Exporting function 'Get-AzStorageAccount'.
[debug]Exporting function 'Get-AzRmStorageAccount'.
[debug]Exporting function 'Get-AzRmResourceGroup'.
[debug]Exporting function 'Get-AzureNetworkInterfaceDetails'.
[debug]Exporting function 'Get-AzurePublicIpAddressDetails'.
[debug]Exporting function 'Get-AzureLoadBalancersDetails'.
[debug]Exporting function 'Get-AzureLoadBalancerDetails'.
[debug]Exporting function 'Get-AzureRMLoadBalancerFrontendIpConfigDetails'.
[debug]Exporting function 'Get-AzureRMLoadBalancerInboundNatRuleConfigDetails'.
[debug]Importing function 'Add-AzureSqlDatabaseServerFirewallRule'.
[debug]Importing function 'Get-AzRmResourceGroup'.
[debug]Importing function 'Get-AzRmStorageAccount'.
[debug]Importing function 'Get-AzRMStorageKeys'.
[debug]Importing function 'Get-AzRmVmCustomScriptExtension'.
[debug]Importing function 'Get-AzStorageAccount'.
[debug]Importing function 'Get-AzStorageKeys'.
[debug]Importing function 'Get-AzureLoadBalancerDetails'.
[debug]Importing function 'Get-AzureLoadBalancersDetails'.
[debug]Importing function 'Get-AzureNetworkInterfaceDetails'.
[debug]Importing function 'Get-AzurePublicIpAddressDetails'.
[debug]Importing function 'Get-AzureRMLoadBalancerFrontendIpConfigDetails'.
[debug]Importing function 'Get-AzureRMLoadBalancerInboundNatRuleConfigDetails'.
[debug]Importing function 'Remove-AzRmVmCustomScriptExtension'.
[debug]Importing function 'Remove-AzureSqlDatabaseServerFirewallRule'.
[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24/Task.json
[debug]Loaded 11 strings.
[debug]SYSTEM_CULTURE: 'en-US'
[debug]Loading resource strings from: D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\Strings\resources.resjson\en-US\resources.resjson
[debug]Loaded 11 strings.
[debug]FilePath= Find-VstsFiles LegacyPattern d:\a\1\s\src\Vics\bin\Release\Database.dacpac
[debug]Entering Find-VstsFiles.
[debug] LiteralDirectory: 'LegacyPattern'
[debug] LegacyPattern: 'd:\a\1\s\src\Vics\bin\Release\Database.dacpac'
[debug]Entering Get-MatchingItems.
[debug] IncludePatterns: 'd:\a\1\s\src\Vics\bin\Release\Database.dacpac'
[debug] ExcludePatterns: ''
[debug] IncludeFiles: 'True'
[debug] IncludeDirectories: 'False'
[debug] Force: 'False'
[debug]Path: d:\a\1\s\src\Vics\bin\Release\Database.dacpac
[debug]Leaving Get-MatchingItems.
[debug]Total found: 1
[debug]Leaving Find-VstsFiles.
packageFile= d:\a\1\s\src\Vics\bin\Release\Database.dacpac
[debug]Server friendly name is tcp:{server}
[debug]ENDPOINT_URL_d77b299c-5a4a-41cd-802e-de906dccbff0: 'https://management.usgovcloudapi.net/'
[debug]ENDPOINT_AUTH_d77b299c-5a4a-41cd-802e-de906dccbff0: '********'
[debug]ENDPOINT_DATA_d77b299c-5a4a-41cd-802e-de906dccbff0: '{"subscriptionId":"{subscriptionId}","subscriptionName":"US Government Azure Enterprise Offer","azureSpnRoleAssignmentId":"","azureSpnPermissions":"","spnObjectId":"","appObjectId":"","creationMode":"Manual","environment":"AzureUSGovernment","environmentUrl":"https://management.usgovcloudapi.net/","galleryUrl":"https://gallery.usgovcloudapi.net/","serviceManagementUrl":"https://management.core.usgovcloudapi.net/","resourceManagerUrl":"https://management.usgovcloudapi.net/","activeDirectoryAuthority":"https://login-us.microsoftonline.com/","environmentAuthorityUrl":"https://login-us.microsoftonline.com/","graphUrl":"https://graph.windows.net/","managementPortalUrl":"https://manage.windowsazure.us/","armManagementPortalUrl":"https://portal.azure.us","activeDirectoryServiceEndpointResourceId":"https://management.core.usgovcloudapi.net/","sqlDatabaseDnsSuffix":".database.usgovcloudapi.net","AzureKeyVaultDnsSuffix":"vault.usgovclouda...
[debug]Reaching SqlServer to check connection by running sqlcmd.exe -S "tcp:{server}.database.usgovcloudapi.net,1433" -U "{user}" -Q "select getdate()"
[debug]
[debug]sqlPackageArguments = /SourceFile:"d:\a\1\s\src\Vics\bin\Release\Database.dacpac" /Action:Publish /TargetServerName:"tcp:{server}.database.usgovcloudapi.net,1433" /TargetDatabaseName:"{instance}" /TargetUser:"{user}" /TargetPassword:"********" /p:BlockOnPossibleDataLoss=False /p:AllowIncompatiblePlatform=True /TargetTimeout:120
[debug]Sql Versions installed on machine factoryvm-az229 as read from registry: 140 130 120 110
[debug]Sql Version Specific Root Dir for version 140 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\140\
[debug]Sql Version Specific Root Dir for version 130 as read from registry: C:\Program Files\Microsoft SQL Server\130\
[debug]Sql Version Specific Root Dir for version 130 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\130\
[debug]Sql Version Specific Root Dir for version 120 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\120\
[debug]Sql Version Specific Root Dir for version 110 as read from registry: C:\Program Files (x86)\Microsoft SQL Server\110\
[debug]Dac Framework (installed with SQL) not found on machine factoryvm-az229
[debug]Dac Framework installed with SQL Version 140 found at C:\Program Files\Microsoft SQL Server\140\DAC\bin\SqlPackage.exe on machine factoryvm-az229
[debug]Getting latest Visual Studio 15 setup instance.
[debug]Entering Invoke-VstsTool.
[debug] FileName: 'D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\vswhere.exe'
[debug] Arguments: '-version [15.0,16.0) -latest -format json'
[debug] RequireExitCodeZero: 'True'
[command]"D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\vswhere.exe" -version [15.0,16.0) -latest -format json
[debug][
[debug] {
[debug] "instanceId": "5fcd044c",
[debug] "installDate": "2017-12-01T18:36:43Z",
[debug] "installationName": "VisualStudio/15.4.5+27004.2010",
[debug] "installationPath": "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise",
[debug] "installationVersion": "15.4.27004.2010",
[debug] "displayName": "Visual Studio Enterprise 2017",
[debug] "description": "Microsoft DevOps solution for productivity and coordination across teams of any size",
[debug] "enginePath": "C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service",
[debug] "channelId": "VisualStudio.15.Release",
[debug] "channelPath": "C:\Users\packer\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\4CB340F5\catalog.json",
[debug] "channelUri": "https://aka.ms/vs/15/release/channel",
[debug] "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.4.5",
[debug] "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708"
[debug] }
[debug]]
[debug]Exit code: 0
[debug]Leaving Invoke-VstsTool.
[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-az229
[debug]Executing SQLPackage.exe
[debug]Executing : "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\140\SqlPackage.exe" /SourceFile:"d:\a\1\s\src\Vics\bin\Release\Database.dacpac" /Action:Publish /TargetServerName:"tcp:{server}.database.usgovcloudapi.net,1433" /TargetDatabaseName:"{instance}" /TargetUser:"{user}" /TargetPassword:"********" /p:BlockOnPossibleDataLoss=False /p:AllowIncompatiblePlatform=True /TargetTimeout:120
Publishing to database '{instance}' on server 'tcp:{server}.database.usgovcloudapi.net,1433'.
Initializing deployment (Start)
Initializing deployment (Failed)
[debug]Error record:
[debug]Execute-Command : *** Could not deploy package.
[debug]At D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1:178 char:9
[debug]+ Execute-Command -FileName $SqlPackagePath -Arguments $scriptA ...
[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Execute-Command
[debug]
[debug]Script stack trace:
[debug]at Execute-Command, D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\Utility.ps1: line 235
[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1: line 178
[debug]at , : line 1
[debug]at , : line 22
[debug]at , : line 18
[debug]at , : line 1
[debug]Exception:
[debug]Microsoft.PowerShell.Commands.WriteErrorException: *** Could not deploy package.
[error]*** Could not deploy package.
[debug]Processed: ##vso[task.logissue type=error]*** Could not deploy package.
[debug]Error record:
[debug]Execute-Command : Unable to connect to master or target server '{instance}'. You must have a user with the same password in master or target server '{instance}'.
[debug]
[debug]At D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1:178 char:9
[debug]+ Execute-Command -FileName $SqlPackagePath -Arguments $scriptA ...
[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Execute-Command
[debug]
[debug]Script stack trace:
[debug]at Execute-Command, D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\Utility.ps1: line 235
[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1: line 178
[debug]at , : line 1
[debug]at , : line 22
[debug]at , : line 18
[debug]at , : line 1
[debug]Exception:
[debug]Microsoft.PowerShell.Commands.WriteErrorException: Unable to connect to master or target server '{server}'. You must have a user with the same password in master or target server '{instance}'.
[debug]
[error]Unable to connect to master or target server '{instance}'. You must have a user with the same password in master or target server '{instance}'.
[debug]Processed: ##vso[task.logissue type=error]Unable to connect to master or target server '{instance}'. You must have a user with the same password in master or target server '{instance}'.%0D%0A
[debug]No Firewall Rule was added
[debug]Caught exception from task script.
[debug]Error record:
[debug]D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1 : Azure SQL Dacpac task failed.
[debug]At line:1 char:1
[debug]+ . 'd:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a ...
[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,DeploySqlAzure.ps1
[debug]
[debug]Script stack trace:
[debug]at , D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.1.24\DeploySqlAzure.ps1: line 234
[debug]at , : line 1
[debug]at , : line 22
[debug]at , : line 18
[debug]at , : line 1
[debug]Exception:
[debug]Microsoft.PowerShell.Commands.WriteErrorException: Azure SQL Dacpac task failed.
[error]Azure SQL Dacpac task failed.
[debug]Processed: ##vso[task.logissue type=error]Azure SQL Dacpac task failed.
[debug]Processed: ##vso[task.complete result=Failed]
[section]Finishing: Execute Azure SQL : DacpacTask
The second, possibly related issue is trying to run our integration tests which access this database. Is there an alternative to creating a powershell script to connect to the correct tenant and execute New-AzureSqlDatabaseServerFirewallRule - run tests - Remove-AzureSqlDatabaseServerFirewallRule?

Can you manually execute the command generated by the debug logs above to deploy from console? does it succeed?
You can try adding firewall rule from the Azure portal and check if it works for you?

Related

Ansible - Gather Facts failed on Windows DC

I´m currently trying to create update Jobs for Windows Servers which mostly works. But on all my DCs (expect one, don´t know why this one is working) gathering facts failed with this error message:
fatal: [hostname]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"exception": "Access denied \r\nAt line:63 char:44\r\n+ ... e_name] = $(Get-CimInstance -Namespace $namespace -ClassName $instanc ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : PermissionDenied: (Root\\CIMV2:Win3...erConfiguration:String) [Get-CimInstance], CimException\r\n + FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand\r\n\r\nScriptStackTrace:\r\nat Get-LazyCimInstance, <No file>: line 63\r\nat <ScriptBlock>, <No file>: line 142\r\n\r\nMicrosoft.Management.Infrastructure.CimException: Access denied \r\n at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback(OperationCallbackProcessingContext callbackProcessingContext, T currentItem, Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle errorDetailsHandle)", "failed": true, "msg": "Unhandled exception while executing module: Access denied "}}, "msg": "The following modules failed to execute: setup\n"}
Executing commands on those DCs are working, only gathering facts failed. On non DCs gathering facts works.
Does anyone have an idea what could be the problem?
Fixed it with update ansible to some > 2.9.
With ansible 2.10 or ansible4 it is working

Playbook is unable to create VM running into fatal error

We have a playbook which create the VM. First time when I ran the infrastructure pipeline VM is created.
After making some "sku" related changes in playbook and trying to run the pipeline again, getting below error.
2020-11-09T09:42:37.7488228Z TASK [ansible-role-adfv2-shir : Install Java Runtime Environment] **************
2020-11-09T09:42:37.7489504Z task path: /opt/ansible-roles/cloud/2020.10-212/ansible-role-adfv2-shir/tasks/install.yml:24
2020-11-09T09:42:37.7491381Z Monday 09 November 2020 04:42:37 -0500 (0:00:31.732) 0:12:49.681 *******
2020-11-09T09:42:37.8258708Z Using module file /home/cvx_admin_user/.ansible-virtualenv/lib/python2.7/site-packages/ansible/modules/windows/win_package.ps1
2020-11-09T09:42:37.8261046Z <10.71.116.128> ESTABLISH WINRM CONNECTION FOR USER: cvx_admin_user on PORT 5986 TO 10.71.116.128
2020-11-09T09:42:37.8261724Z checking if winrm_host 10.71.116.128 is an IPv6 address
2020-11-09T09:42:37.8262337Z <10.71.116.128> WINRM CONNECT: transport=ssl endpoint=https://10.71.116.128:5986/wsman
2020-11-09T09:42:37.9552112Z <10.71.116.128> WINRM OPEN SHELL: 6450AAB3-A367-49DA-B034-B197FC2A464D
2020-11-09T09:42:37.9555186Z EXEC (via pipeline wrapper)
2020-11-09T09:42:37.9558598Z <10.71.116.128> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-']
2020-11-09T09:43:15.3305027Z <10.71.116.128> WINRM RESULT u'<Response code 0, out "{"stdout":"","rc":16", err "">'
2020-11-09T09:43:15.3361619Z <10.71.116.128> WINRM CLOSE SHELL: 6450AAB3-A367-49DA-B034-B197FC2A464D
**2020-11-09T09:43:15.3500563Z fatal: [corest-tsir00]: FAILED! => {
2020-11-09T09:43:15.3530075Z "changed": false,
2020-11-09T09:43:15.3560075Z "exit_code": 1618,
2020-11-09T09:43:15.3560924Z "msg": "unexpected rc from install C:\\ExeSources\\jre8u191windowsx64.exe: see rc, stdout and stderr for more details",
2020-11-09T09:43:15.3561602Z "rc": 1618,
2020-11-09T09:43:15.3562066Z "reboot_required": false,
2020-11-09T09:43:15.3562571Z "restart_required": false,
2020-11-09T09:43:15.3563039Z "stderr": "",
2020-11-09T09:43:15.3563488Z "stderr_lines": [],
2020-11-09T09:43:15.3563938Z "stdout": "",
2020-11-09T09:43:15.3564377Z "stdout_lines": []
2020-11-09T09:43:15.3564820Z }**
I am not sure why I am getting this error. Please help me out with this error.
Thanks!
Your return code for jre8u191windowsx64.exe is 1618, which means ERROR_INSTALL_ALREADY_RUNNING. The MSI error code page tells us that:
Another installation is already in progress. Complete that installation before proceeding with this install.

How to run a PowerShell / ImapX script manually or in Task Scheduler?

I'm running this script in PowerShell ISE and it works great and it downloads the attachments to the folder I've specified.
But if I run it manually in PowerShell using
PS C:\tmp> .\pdftofolder.ps1
it doesn't download the attachments and the log says this:
**********************
Windows PowerShell transcript start
Start time: 20200517211912
Username: MON1\Administrator
RunAs User: MON1\Administrator
Configuration Name:
Machine: MON1 (Microsoft Windows NT 10.0.17763.0)
Host Application: C:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
Process ID: 1708
PSVersion: 5.1.17763.1007
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.17763.1007
BuildVersion: 10.0.17763.1007
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is C:\tmp\log.txt
GAC Version Location
--- ------- --------
False v4.0.30319 C:\tmp\ImapX.dll
True
True
**********************
Windows PowerShell transcript end
End time: 20200517211912
**********************
And if I run it through the Task Scheduler (which is the ultimate goal) it just gets stuck. I run it with this command (its ran with highest privileges btw):
Start-Transcript -path C:\tmp\log.txt -append
$dll = 'C:\tmp\ImapX.dll'
[Reflection.Assembly]::LoadFile($dll)
$Username = "email#email.com"
$Password = "foo"
# Initialize the IMAP client
$client = New-Object ImapX.ImapClient
###set the fetching mode to retrieve the part of message you want to retrieve,
###the less the better
$client.Behavior.MessageFetchMode = "Full"
$client.Host = "mail.foo.com"
$client.Port = 993
$client.UseSsl = $true
$client.Connect()
$client.Login($Username, $Password)
foreach($m in $messages){
$m.Subject
foreach($r in $m.Attachments){
Write-Host $m.Attachments
$r.Download()
$r.Save('C:\tmp\dl')
}
}
Stop-Transcript
What part of running a PowerShell script made after its built in ISE have I missed? Thanks in advance.
You've skipped
$messages = $client.Folders.Inbox.Search("ALL", $client.Behavior.MessageFetchMode, 1000)

javax.net.ssl.SSLException after nativescript-messenger installation in nativescript

I installed project using vue-cli-template
https://github.com/nativescript-vue/vue-cli-template/tree/master
I installed nativescript-messenger and even without changes in code I saw error
Error: Command ./gradlew failed with exit code 1 Error output:
Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
We cannot present there full output of command:
cd dist && tns run android --device ZY223J2852 --log trace
but below is start and end of log trace.
Loading extensions.
Asserting extension nativescript-cloud is installed.
Extension nativescript-cloud is installed.
System information:
{ platform: 'linux',
shell: '/bin/bash',
os: 'Linux daniel-Inspiron-3543 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux\n',
procArch: 'x64',
nodeVer: '8.11.1',
npmVer: '6.2.0',
nodeGypVer: null,
nativeScriptCliVersion: '4.1.2',
gitVer: '2.17.1',
dotNetVer: null,
javacVersion: '1.8.0_171',
adbVer: '1.0.40',
androidInstalled: true,
monoVer: null,
gradleVer: '4.9',
isAndroidSdkConfiguredCorrectly: true,
xcodeVer: undefined,
xcodeprojLocation: null,
itunesInstalled: false,
cocoaPodsVer: undefined,
isCocoaPodsWorkingCorrectly: false,
isCocoaPodsUpdateRequired: false,
pythonInfo: null }
Looking for project in '/home/daniel/pro/sms_api/dist'
Project directory is '/home/daniel/pro/sms_api/dist'.
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
Will send the following information to Google Analytics: { type: 'googleAnalyticsData',
category: 'CLI',
googleAnalyticsDataType: 'event',
action: 'Check Local Build Setup',
label: 'Starting',
customDimensions: { cd5: 'CLI' } }
...
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
'/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
'/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command prepareJSApp is after-prepareJSApp
Project dir from hooksArgs is: undefined.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
'/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
'/home/daniel/pro/sms_api/dist/hooks' ]
BeforeHookName for command buildAndroidPlugin is before-buildAndroidPlugin
spawn: ./gradlew "-p" "/home/daniel/pro/sms_api/dist/platforms/tempPlugin/nativescript_messenger" "assembleRelease" "-PcompileSdk=android-27" "-PbuildToolsVersion=27.0.3" "-PsupportVersion=26.0.0-alpha1"
Unable to apply changes on device: ZY223J2852. Error is: Failed to build plugin nativescript-messenger :
Error: Command ./gradlew failed with exit code 1 Error output:
Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1964)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1921)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1904)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1420)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at org.gradle.wrapper.Download.downloadInternal(Download.java:60)
at org.gradle.wrapper.Download.download(Download.java:45)
at org.gradle.wrapper.Install$1.call(Install.java:62)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:91)
at sun.security.validator.Validator.getInstance(Validator.java:179)
at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:312)
at sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:171)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:184)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1596)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
... 14 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:89)
... 26 more
.
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
'/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
'/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command watch is after-watch
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
'/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
'/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command liveSync is after-liveSync
sudo update-ca-certificates -f
^CProject dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
'/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
'/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command watch is after-watch
Project dir from hooksArgs is: /home/daniel/pro/sms_api/dist.
Hooks directories: [ '/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/hooks',
'/home/daniel/.nvm/versions/node/v8.11.1/lib/node_modules/nativescript/lib/common/hooks',
'/home/daniel/pro/sms_api/dist/hooks' ]
AfterHookName for command watch is after-watch
I was trying
sudo update-ca-certificates -f
but it does not help.
System
Ubuntu 18.04
java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
I replace openjdk by Oracle Java following by
https://github.com/mesosphere/hdfs-deprecated/issues/141
but it does not works too.
I had the same error after installing nativescript-phone.
I fixed thanks
https://stackoverflow.com/a/50103533/6398044
Bug was connected with
JEP 229, switch from the jks keystore default format to the pkcs12 format
Workaround:
sudo su
/usr/bin/printf '\xfe\xed\xfe\xed\x00\x00\x00\x02\x00\x00\x00\x00\xe2\x68\x6e\x45\xfb\x43\xdf\xa4\xd9\x92\xdd\x41\xce\xb6\xb2\x1c\x63\x30\xd7\x92' > /etc/ssl/certs/java/cacerts
/var/lib/dpkg/info/ca-certificates-java.postinst configure

Connect Spring roo project to Mongo database

I am new too roo and trying to create a simple app to push to Heroku. I have the app up and working on my localhost with a MongoDB running on the localhost as well. I added a MongoDB to the app in Heroku but it will not open on Heroku (the app not the DB). I don't know what the issue is but do I need to connect my app to the Heroku DB somehow? As in changing the database.properties file? I tried to test it locally using the Heroku DB by taking this URL (Which I can use to log into the DB just fine with mongoctl):
mongodb://heroku_app10830648:************************#ds047387.mongolab.com:4738/heroku_app10830648
and putting the info into the database.properties file:
#Updated at Wed Jan 09 19:16:49 MST 2013
#Wed Jan 09 19:16:49 MST 2013
mongo.database=heroku_app10830648
mongo.host=ds047387.mongolab.com
mongo.password=***********************
mongo.port=47387
mongo.username=heroku_app10830648
but when I build it with mvn package I get this error:
T E S T S
Results:
Tests in error:
testFindNotebook(com.xebia.shortnotes.domain.NotebookIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testFindAllNotebooks(com.xebia.shortnotes.domain.NotebookIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testFindNotebookEntries(com.xebia.shortnotes.domain.NotebookIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testSaveNotebook(com.xebia.shortnotes.domain.NotebookIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testDeleteNotebook(com.xebia.shortnotes.domain.NotebookIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.notebook lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testCountAllNotes(com.xebia.shortnotes.domain.NoteIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testFindNote(com.xebia.shortnotes.domain.NoteIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testFindAllNotes(com.xebia.shortnotes.domain.NoteIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testFindNoteEntries(com.xebia.shortnotes.domain.NoteIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testSaveNote(com.xebia.shortnotes.domain.NoteIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
testDeleteNote(com.xebia.shortnotes.domain.NoteIntegrationTest): command failed [command failed [count] { "assertion" : "unauthorized db:heroku_app10830648 ns:heroku_app10830648.note lock type:0 client:71.208.224.103" , "assertionCode" : 10057 , "errmsg" : "db assertion failure" , "ok" : 0.0}
Tests run: 14, Failures: 0, Errors: 12, Skipped: 0
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
How do I use a different DB besides local in a mvn project.
[This post seems to be dormant, but I just ran into the same problem, and this is the top match in Google.]
I'm using a Spring/Roo/Mongo application which worked fine in "dev" mode, but when deployed to a cloud provider (OpenShift, CloudBees, Heroku, etc) and connecting to MongoHQ, the DB connections fail with the message:
command failed [command failed [count] { "ok" : 0.0 , "errmsg" :
"unauthorized"}
Turns out the problem is in the auto-generated applicationContext-mongo.xml file. You need to add the username and password attributes:
<mongo:db-factory dbname="${mongo.name}" host="${mongo.host}" id="mongoDbFactory" port="${mongo.port}" username="${mongo.username}" password="${mongo.password}"/>
Here's a (likely outdated) link to the official docs (if it helps): http://static.springsource.org/spring-data/data-mongo/docs/1.0.0.M5/reference/html/#d0e1210
One other tip: use spring.profiles.active to make your application select the correct credentials/configuration based on the dev-mode, or running within a specific cloud provider. It would be really nice if each PaaS would define a Java System Property like "current.paas=heroku" to make auto-configuration easier.

Resources