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

Can't supply container registry credentials to Container App. #921

Open
isaacabraham opened this issue Apr 29, 2022 · 7 comments
Open

Can't supply container registry credentials to Container App. #921

isaacabraham opened this issue Apr 29, 2022 · 7 comments
Labels
arm-resource bug Something isn't working

Comments

@isaacabraham
Copy link
Member

isaacabraham commented Apr 29, 2022

Something is up with the Container App / Container Registry integration. I could swear that this worked a month or so ago, but I tried creating a new container app service today. This is the offending line:

containerApp {
    reference_registry_credentials [ Arm.ContainerRegistry.registries.resourceId mySuperRegistry.Name ]
}

where mySuperRegistry is an Azure container registry that already exists.

When I try an deploy the container app, I get the following validation error:

{'code': 'ContainerAppInvalidPropertyValue', 'message': "Property 'secrets.name' has an invalid value '[listCredentials(resourceId('Microsoft.ContainerRegistry/registries', 'mySuperRegistry'), '2019-05-01').username]'. A value must consist of lower case alphanumeric characters, '-'
 or '.', and must start and end with an alphanumeric character."}
)

Here's an extract of the raw ARM template:

          "registries": [
            {
              "passwordSecretRef": "[listCredentials(resourceId('Microsoft.ContainerRegistry/registries', 'mySuperRegistry'), '2019-05-01').username]",
              "server": "[reference(resourceId('Microsoft.ContainerRegistry/registries', 'mySuperRegistry'), '2019-05-01').loginServer]",
              "username": "[listCredentials(resourceId('Microsoft.ContainerRegistry/registries', 'mySuperRegistry'), '2019-05-01').username]"
            }
          ],
          "secrets": [
            {
              "name": "[listCredentials(resourceId('Microsoft.ContainerRegistry/registries', 'mySuperRegistry'), '2019-05-01').username]",
              "value": "[listCredentials(resourceId('Microsoft.ContainerRegistry/registries', 'mySuperRegistry'), '2019-05-01').passwords[0].value]"
            }
          ]

It's almost as though ARM hasn't seen that secrets.name is an expression, and has instead tried to parse the expression as a raw string.

@ninjarobot Have you any idea about this - or if this ever used to work?
@anthonychu has anything changed in the way that secret names are handled in terms of ARM template support - maybe something has changed since the namespace move?

@anthonychu
Copy link

Sounds like it’s the same as this microsoft/azure-container-apps#153

@isaacabraham
Copy link
Member Author

Ok, at least I'm not imagining things! Thanks

@et1975
Copy link
Contributor

et1975 commented May 3, 2022

Just hit this as well, this line does not pass the template validation, which I think is a different issue - ARM doesn't seem to be evaluating the name expression, treating it as a constant instead.

et1975 added a commit to et1975/farmer that referenced this issue May 3, 2022
@isaacabraham
Copy link
Member Author

@et1975 that's exactly the same issue :-)

@et1975
Copy link
Contributor

et1975 commented May 4, 2022

I was referring to the linked ARM/biceps issue, which is specifically about naming of the registry. The PR I have opened fixed both issues.

@isaacabraham
Copy link
Member Author

I see! I think it's the same underlying issue - ARM isn't evaluating expressions in the template in certain fields.

The fix you've put in is of course a really nice workaround, by not using an ARM expression at all.

et1975 added a commit to et1975/farmer that referenced this issue May 5, 2022
@isaacabraham isaacabraham added bug Something isn't working arm-resource labels May 6, 2022
@martinbryant
Copy link
Contributor

@isaacabraham - looking to close this one if the fix solved the issue?

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

No branches or pull requests

4 participants