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

[BUG]-Bicep issues found: Unable to restore the module with reference #359

Open
Kludon opened this issue Mar 13, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Kludon
Copy link

Kludon commented Mar 13, 2024

Describe the bug

msdo.sarif.txt
We use bicep files that has a reference to our own Container registry.
But the analyzer failed on the reference.

We use the analyzer in our pipeline in devops in a yaml file like this

- task: MicrosoftSecurityDevOps@1
    displayName: 'Microsoft Security DevOps'    
    env:
        GDN_TEMPLATEANALYZER_ANALYZEDIRECTORY: '$(Build.ArtifactStagingDirectory)/infra/bicep/'        
    inputs:      
      tools: 'templateanalyzer'

After we run the pipeline we get the following exception in the sarif file (see attachment)

Unhandled exception: Azure.Identity.CredentialUnavailableException: The ChainedTokenCredential failed to retrieve a token from the included credentials.
- Please run 'az login' to set up account
- Please run 'Connect-AzAccount' to set up account

We use our own buildagent with a service connection that has read access on the container registry.

If I use az login on a previous task in the pipeline the same error ouccered.

Expected behavior

Use the credentials from the serviceconnection or create an input parameter for the service connection and then you can read the conttainer registry templae.

Reproduction Steps

Create a container registry and put a bicep template in it.
Set read rights on the container registry for your service connection and in your repository create a bicep with module reference to the container registry. Create a yaml pipeline with that analyze our bicep.

Environment

No response

@Kludon Kludon added bug Something isn't working 🔍 needs-triage labels Mar 13, 2024
@nonik0
Copy link
Contributor

nonik0 commented Apr 18, 2024

Thanks for reporting this. It's likely we will need to take a look at our bicep integration to see where the auth flow is going wrong. But I should note that we have not specifically tested scenarios like this with the bicep integration yet, where bicep templates depend on modules in private registries, so for now I would consider these scenarios as unsupported in template-analyzer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants