azure-quickstart-templates icon indicating copy to clipboard operation
azure-quickstart-templates copied to clipboard

Container Apps with Azure Container Registry

Open Gordonby opened this issue 3 years ago • 3 comments

New quickstart to demonstrate how to use a ACR from Container Apps, leveraging a User Assigned Managed Identity.

PR Checklist

Check these items before submitting a PR...

Contribution Guide

Best Practice Guide

  • [x] - Please check this box once you've submitted the PR if you've read through the Contribution Guide and best practices checklist.

Gordonby avatar Aug 03 '22 08:08 Gordonby

@Gordonby , i am trying to do something very similar over in this PR. https://github.com/Azure/azure-quickstart-templates/pull/12699 Except, instead of the images being truely public, I am trying to ingest images from the Azure Marketplace.

I am still debugging some issues with my custom script action, but do you think it would make sense to include this directly in your bicep module you are using instead?

dciborow avatar Aug 03 '22 21:08 dciborow

@Gordonby , i am trying to do something very similar over in this PR. #12699 Except, instead of the images being truely public, I am trying to ingest images from the Azure Marketplace.

I am still debugging some issues with my custom script action, but do you think it would make sense to include this directly in your bicep module you are using instead?

@dciborow You're meaning your container_deploy.sh ?

This PR is relating primarily to Container Apps, the importing of images is just leveraging an existing module in the bicep registry. It's not really a focus of the quickstart template.

If you're wondering if I think the script is a good addition to the existing import module in the public bicep registry, I think submitting it as a new module proposal would be the better option.

Gordonby avatar Aug 04 '22 08:08 Gordonby

@bmoore-msft - I think the best practice checking in the CICD is being confused because either

  1. there's a parameter called images and also an output by the same name.
  2. the array output only contains one item, and powershell (or something else) is simplifying it to a string

This template deploys great locally, but the best-practice warning fails in the CICD.

Type Mismatch: Parameter 'images' in nested template 'importContainerImage' is defined as array, but the parent template defines it as string). Line: 352, Column: 14

Gordonby avatar Aug 04 '22 10:08 Gordonby

@bmoore-msft - thoughts on my last comment?

Gordonby avatar Sep 28 '22 09:09 Gordonby

the best practice test won't fail the pipeline (just a warning) but the build has been deleted so can't see the error... I'll start another build.

bmoore-msft avatar Sep 30 '22 18:09 bmoore-msft

/azp run

bmoore-msft avatar Sep 30 '22 18:09 bmoore-msft

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Sep 30 '22 18:09 azure-pipelines[bot]

@Gordonby - can you check the deployment failure?

bmoore-msft avatar Oct 04 '22 21:10 bmoore-msft

@Gordonby - can you check the deployment failure?

@bmoore-msft

1

Microsoft.Authorization/roleAssignments uses a preview version ( 2020-10-01-preview ) and there are more recent versions available. Line: 114, Column: 8

Ok, new error - easy to fix....

2

[error] Type Mismatch: Parameter 'images' in nested template 'importContainerImage' is defined as array, but the parent template defines it as string). Line: 352, Column: 14

This was the error message that was confusing me before. Images is a parameter in the bicep registry module. It's defined as array.

3

Function 'format' found within 'acrHostedImageUri'

Another new error...

Not sure why using format is a bad thing...? I'm using it to manipulate the image string from the public registry to the private one that its now in.

image

output images array = [for image in images: {
  originalImageUri: image
  acrHostedImageUri : '${acr.properties.loginServer}${skip(image, indexOf(image,'/'))}'
}]

Gordonby avatar Oct 06 '22 08:10 Gordonby

2 - looks to be a limitation in the TTK 3 - use the uri() function to create uris

bmoore-msft avatar Oct 06 '22 20:10 bmoore-msft

@bmoore-msft

2 - ok 3 - URI sounds great, but i'm not sure if it's entirely geared towards a container registry

The template language function 'uri' expects its first argument to be a uri string. The provided value is 'crijuu6sairdtri.azurecr.io'

Gordonby avatar Oct 07 '22 14:10 Gordonby

Try:

  acrHostedImageUri : uri('https://${acr.properties.loginServer}', string(skip(image, indexOf(image, '/'))))

The last string() requirement seems like a bicep bug - but should work in any case...

bmoore-msft avatar Oct 07 '22 15:10 bmoore-msft

@bmoore-msft i think this is about ready now

Gordonby avatar Oct 11 '22 17:10 Gordonby