Closed v1ferrarij closed 1 week ago
Hello @v1ferrarij, it looks like the error is an internal packer exception.
Could you please try execute the packer build
command with plain password or re-defined environment variable?
And make sure that your $Env:servicePrincipalKey
variable is not empty.
Your issue looks like this one - https://github.com/hashicorp/packer/issues/8619#issuecomment-580449258
Like this:
$servicePrincipalSecret = $Env:servicePrincipalKey
packer build `
-var "build_resource_group_name=images-rg" `
-var "managed_image_resource_group_name=images-rg" `
-var "client_id=$Env:servicePrincipalId" `
-var "client_secret=$servicePrincipalSecret" `
-var "subscription_id=$Env:subscriptionId" `
-var "managed_image_name=win22-20240421.1" `
-force ".\windows-2022.pkr.hcl"
Hello @v1ferrarij, it looks like the error is an internal packer exception. Could you please try execute the
packer build
command with plain password or re-defined environment variable? And make sure that your$Env:servicePrincipalKey
variable is not empty.Your issue looks like this one - hashicorp/packer#8619 (comment)
Like this:
$servicePrincipalSecret = $Env:servicePrincipalKey packer build ` -var "build_resource_group_name=images-rg" ` -var "managed_image_resource_group_name=images-rg" ` -var "client_id=$Env:servicePrincipalId" ` -var "client_secret=$servicePrincipalSecret" ` -var "subscription_id=$Env:subscriptionId" ` -var "managed_image_name=win22-20240421.1" ` -force ".\windows-2022.pkr.hcl"
Hi @Alexey-Ayupov
I have tried your suggestion and I get the same result.
I have also tried authentication with the azure cli by logging in via azure cli and adding use_azure_cli_auth = true
to the template file.
I have tried both methods on two different Azure Tenants just to make sure there is nothing like policies affecting anything, same result on both.
Really not sure what is going on, I built an image a couple of weeks ago with no issues using the same methods.
The Ubuntu builds still work fine as expected.
Hello @v1ferrarij. I have managed to reproduce your issue on my machine. Apparently your packer invoke for windows images lack the password for virtual machine in Azure. I have added -var "install password=$Install Password"
and my build executes successfully.
This snippet was used. As you can see, I only used one variable for testing purposes to minimize possible errors.
$secret = "somereallylongsecret00000300000"
$InstallPassword = "AzureStrongPaSS01"
packer build `
-var "build_resource_group_name=some-rg" `
-var "managed_image_resource_group_name=some-rg" `
-var "client_id=aaaaaaaa-1111-bbbb-cccc-xxxxxxxxxxxx" `
-var "client_secret=$secret" `
-var "subscription_id=vvvvvvvv-2222-ffff-gggg-yyyyyyyyyyyy" `
-var "managed_image_name=win22-test" `
-var "install_password=$InstallPassword" `
-force ".\windows-2022.pkr.hcl"
Please try the packer build
command with the install_password
variable.
Hi @Alexey-Ayupov That seems to have done the job! Thanks.
Is this a new thing? I didn't have to do this before...
Hello @v1ferrarij. We use this options all the time, so I am not aware of the cases where we do not need to use a password for a packaged VM.
Description
I create VM images from this repository on a regular basis, however, today I am facing an issue when building win22.
I am using the follow file https://github.com/actions/runner-images/blob/main/images/windows/templates/windows-2022.pkr.hcl to create the image, I am not changing anything in the file.
I simply use the below command to execute the build
I am facing the below error:
I am not doing anything different than usual, any idea what is going on?
Platforms affected
Runner images affected
Image version and build link
win22 / 20240421.1
Is it regression?
No
Expected behavior
Image should build without errors.
Actual behavior
Method invocation failed because [System.__ComObject] does not contain a method named 'Run'.
Repro steps