Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CertificateImproperlyFormatted when using SSH to connect to Azure Windows10 VM #10810

Closed
scott-gilchrist opened this issue Mar 23, 2021 · 2 comments

Comments

@scott-gilchrist
Copy link

Issue

When using the "file" provisioner to copy a file to an Azure Windows VM packer fails to connect giving a CertificateImproperlyFormatted error. This happens even when an ssh username and password are provided.

Packer JSON file

{
"builders" : [{
	"type": "azure-arm",
	"client_id": "<id>",
	"client_secret": "<secret>",
	"tenant_id": "<id>",
	"subscription_id": "<id>",

	"managed_image_resource_group_name": "packerOutput",
	"managed_image_name": "Image2021Win10",

	"os_type": "Windows",
	"image_publisher": "MicrosoftWindowsDesktop",
	"image_offer": "windows-10",
	"image_sku": "20h1-pro-g2", 

	"communicator": "ssh",
	"ssh_port": "22",

	"location": "uksouth",
	"vm_size": "Standard_DS4_v2"
    }],

   "provisioners": [
	{
	    "type" : "file",
	    "source" : "files/file.zip",
	    "destination" : "C:\\tmp\\file.zip"
	}
    ]
}

Error Output

The following build log is output by packer:

==> azure-arm: Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details." Details=[{"code":"Conflict","message":"{\r\n "status": "Failed",\r\n "error": {\r\n "code": "ResourceDeploymentFailure",\r\n "message": "The resource operation completed with terminal provisioning state 'Failed'.",\r\n "details": [\r\n {\r\n "code": "CertificateImproperlyFormatted",\r\n "message": "The secret retrieved from https://pkrkvyeatfcs2q3.vault.azure.net/secrets/packerKeyVaultSecret/4h294bf7v61e4d4b8b854f0a462fac20 is empty string."\r\n }\r\n ]\r\n }\r\n}"}]
==> azure-arm: Removing the created Deployment object: 'pkrdpyeatfcs2q3'
==> azure-arm: Removing the created Deployment object: 'kvpkrdpyeatfcs2q3'
==> azure-arm: ==> azure-arm: Cleanup requested, deleting resource group ...
==> azure-arm: Resource group has been deleted.
Build 'azure-arm' errored after 4 minutes 20 seconds: Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details." Details=[{"code":"Conflict","message":"{\r\n "status": "Failed",\r\n "error": {\r\n "code": "ResourceDeploymentFailure",\r\n "message": "The resource operation completed with terminal provisioning state 'Failed'.",\r\n "details": [\r\n {\r\n "code": "CertificateImproperlyFormatted",\r\n "message": "The secret retrieved from https://pkrkvyeatfcs2q3.vault.azure.net/secrets/packerKeyVaultSecret/4h294bf7v61e4d4b8b854f0a462fac20 is empty string."\r\n }\r\n ]\r\n }\r\n}"}]

WinRM alternative

I can't use WinRM as the file I'm copying to Azure is abysmally slow and takes over 16hours to copy a 1.5GB file. The only other option I have is using SSH unless there's another workaround for this issue?

Thanks.

@ghost
Copy link

ghost commented Apr 30, 2021

This issue has been automatically migrated to hashicorp/packer-plugin-azure#48 because it looks like an issue with that plugin. If you believe this is not an issue with the plugin, please reply to hashicorp/packer-plugin-azure#48.

@ghost ghost closed this as completed Apr 30, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 31, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants