Skip to content

Image build failure #12003

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

Closed
2 of 15 tasks
jaswant-dnv opened this issue Apr 12, 2025 · 15 comments
Closed
2 of 15 tasks

Image build failure #12003

jaswant-dnv opened this issue Apr 12, 2025 · 15 comments

Comments

@jaswant-dnv
Copy link

Description

Image build failure with message(same issue with windows build as well)

##[debug] . '/agent/_work/_temp/azureclitaskscript1744449493277.ps1'
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/agent/_work/_temp/azureclitaskscript1744449493277.ps1'
GenerateResourcesAndImage : A parameter cannot be found that matches parameter name 'Force'.
At /agent/_work/_temp/azureclitaskscript1744449493276_inlinescript.ps1:23 char:27

  • GenerateResourcesAndImage @CreateImageParams
  •                       ~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : InvalidArgument: (:) [GenerateResourcesAndImage], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : NamedParameterNotFound,GenerateResourcesAndImage

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

20250406.1.0

Is it regression?

NA

Expected behavior

image build success

Actual behavior

##[debug] . '/agent/_work/_temp/azureclitaskscript1744449493277.ps1'
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/agent/_work/_temp/azureclitaskscript1744449493277.ps1'
GenerateResourcesAndImage : A parameter cannot be found that matches parameter name 'Force'.
At /agent/_work/_temp/azureclitaskscript1744449493276_inlinescript.ps1:23 char:27

  • GenerateResourcesAndImage @CreateImageParams
  •                       ~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : InvalidArgument: (:) [GenerateResourcesAndImage], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : NamedParameterNotFound,GenerateResourcesAndImage

Repro steps

Rerun pipeline

@Prabhatkumar59
Copy link
Contributor

Hi @jaswant-dnv - Thank you for bringing this issue to our attention. We will look into this issue and will update you after investigating.

@Prabhatkumar59
Copy link
Contributor

Hi @jaswant-dnv - Latest image version has been rolled out. Please update your sync process and try using the latest version 20250415.1. Let us know if you encounter any further issues. Thanks!

@jaswant-dnv
Copy link
Author

jaswant-dnv commented Apr 19, 2025

Still the same error.
Verified image version it is trying to build(it is same as you suggested 20250415.1)

#[debug] -Command
##[debug] . '/agent/_work/_temp/azureclitaskscript1745057821534.ps1'
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/agent/_work/_temp/azureclitaskscript1745057821534.ps1'
GenerateResourcesAndImage : A parameter cannot be found that matches parameter name 'Force'.
At /agent/_work/_temp/azureclitaskscript1745057821533_inlinescript.ps1:23 char:27

  • GenerateResourcesAndImage @CreateImageParams
  •                       ~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : InvalidArgument: (:) [GenerateResourcesAndImage], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : NamedParameterNotFound,GenerateResourcesAndImage

##[debug]Process exited with code 1 and signal null for tool '/usr/bin/pwsh'
##[debug]STDIO streams have closed and received exit code 1 and signal null for tool '/usr/bin/pwsh'
##[debug]task result: Failed
##[error]Script failed with exit code: 1
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=3b946847-8d3b-46c8-a84a-3e5b25f2d097;]Script failed with exit code: 1
##[debug]Processed: ##vso[task.complete result=Failed;]Script failed with exit code:

Any changes with GenerateResourcesAndImage.ps1...as it do not find paramter 'Force'???

We recently used Managed identity instead of service principal.
Changes are made ADO Service connection and reference in code to MI instead of SP.
Not sure if this is causing issue.

@Prabhatkumar59
Copy link
Contributor

Hi @jaswant-dnv - Thanks for your input, we will check on this and will update you further.

@Prabhatkumar59
Copy link
Contributor

@jaswant-dnv - In meantime, could you also please provide failed build or Repro link, thanks!

@kishorekumar-anchala
Copy link
Contributor

Hi @jaswant-dnv ,

I hope you are using customized scripts instead of the runner image. Could you kindly confirm? If so, would you be able to share the code? We haven’t encountered this error while building the image with the runner-images repository. Thank you!

@jaswant-dnv
Copy link
Author

jaswant-dnv commented Apr 30, 2025

We are using the runner image and passing the parameters to GenerateResourcesAndImage.ps1 during the generate image task.

      - task: AzureCLI@2
        displayName: 'Generate Image'
        inputs:
          workingDirectory: '$(Agent.BuildDirectory)/s/runner-images'
          scriptLocation: 'inlineScript'
          scriptType: 'pscore'
          azureSubscription: <service connection using managed identity>    <This we changed as we switched from SP to MI>
          addSpnToEnvironment: true
          inlineScript: |
            $env:VNET_RESOURCE_GROUP = <network Group>
            $env:VNET_NAME =<vnet name>
            $env:VNET_SUBNET = <subnet name>
            
            Import-Module ./helpers/GenerateResourcesAndImage.ps1
            $PSNativeCommandArgumentPassing = 'Legacy'
            
            $CreateImageParams = @{
              ImageType = '${{ parameters.image_type }}'
              SubscriptionId = '$(subscription_id)'
              ResourceGroupName = '${{ parameters.resource_group }}'
              AzureLocation = '${{ parameters.location }}'
              AzureClientId = $env:servicePrincipalId
              AzureClientSecret = $env:servicePrincipalKey
              AzureTenantId = $env:tenantId
              Force = $True
              OnError = '${{ parameters.on_error }}'
              Tags = @{
                ExcludeMdeAutoProvisioning = $True
              }
            }
            
            GenerateResourcesAndImage @CreateImageParams

We tested setup by removing client secret reference but no luck. This seems setup struggle with authenticating MI.
We also observed Force parameter is not listed in GenerateResourcesAndImage.ps1

@Prabhatkumar59
Copy link
Contributor

Hi @jaswant-dnv - Could you please update your sync process and try using the latest version 20250427.1 and confirm us if you encounter any further issues. Thanks!

@jaswant-dnv
Copy link
Author

jaswant-dnv commented May 3, 2025

Tested this again and it failed with error.

It verifies if image exist in our image gallery.

Image

Failed with below error

Image

Any specific instructions for using managed identity instead of service principal which we may need to pass to GenerateResourcesAndImage.ps1.

@Prabhatkumar59
Copy link
Contributor

Hi @jaswant-dnv - Thanks for your inputs. We are checking further and will update your shortly on this.

@Prabhatkumar59
Copy link
Contributor

Hi @jaswant-dnv -It appears to be specific to your pipeline setup. Could you please review your pipeline configuration once from your end? Thanks!

@jaswant-dnv
Copy link
Author

jaswant-dnv commented May 12, 2025

We have reviewed this ONLY Change was using Managed identity. Are there any specific instructions, guidelines or limitations for Managed Identity use with this setup??

@Prabhatkumar59
Copy link
Contributor

Prabhatkumar59 commented May 13, 2025

Hi @jaswant-dnv - Thanks for confirming! The error likely relates to using Managed Identity with a script expecting SPN parameters(clientId, tenantId, etc).
So, please ensure that:-
The script supports MSI (not expecting -Force or SPN args).
MSI has the required roles (Contributor, Image Contributor).
Also check whether you're using the latest script version.
I will close the issue for now. Let us know in case of further concerns


@kishorekumar-anchala
Copy link
Contributor

Hi @jaswant-dnv - As mentioned by @Prabhatkumar59 above, this issue does not relate to the runner images code. Based on our observations, the likely causes seem to be either a lack of necessary permissions or a path mismatch. Therefore, we are moving this issue to a discussion.

Could you kindly confirm the following?

  1. Do you or the service provider have the correct permissions to build the pipeline?
  2. Have you validated the script paths to ensure they are correctly configured?
  3. We recommend trying PowerShell (pwsh) instead of PowerShell Core. Could you please give it a try and let us know the outcome?

Your confirmation on these points would be greatly appreciated!

@kishorekumar-anchala kishorekumar-anchala converted this issue into a discussion May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants