Skip to content

App Service publishing credentials can't be used as Bicep resource type #2504

Description

@johndowns

Bicep version
Bicep CLI version 0.3.255 (589f037)

Describe the bug
I'm trying to create an idiomatic Bicep conversion of this JSON template expression:

"[concat(list(resourceId('Microsoft.Web/sites/config', parameters('webapp-name'), 'publishingcredentials'), '2015-08-01').properties.scmUri, '/docker/hook')]"

I have a working version using the resourceId() function (see below), but I've been trying to model this in a more Bicep-native way using existing, and have run into a roadblock. I've tried to use this Bicep code:

resource app 'Microsoft.Web/sites@2019-08-01' existing = {
  name: webappName

  resource publishingCredentials 'config' existing = {
    name: 'publishingcredentials'
  }
}

output url string = '${list(app:publishingCredentials.id, '2019-08-01').properties.scmUri}/docker/hook'

However, the validation complains that the name publishingcredentials isn't valid for the nested config resource (BCP036).

I'm not clear if this is purely an issue with the App Service OpenAPI metadata not including the publishingcredentials name as a type discriminator, or if there's something Bicep could/should be doing differently. For example, it'd be nice if I could override the BCP036 error with the any() function, but I can't.

To Reproduce
Steps to reproduce the behavior:

See above.

Additional context
Add any other context about the problem here.

This code works, but it feels icky:

output url string = '${list(resourceId('Microsoft.Web/sites/config', webappName, 'publishingcredentials'), '2019-08-01').properties.scmUri}/docker/hook'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions