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

The language expression property 'administratorLoginPassword' doesn't exist #2715

Closed
ielcoro opened this issue May 18, 2021 · 9 comments
Closed

Comments

@ielcoro
Copy link

ielcoro commented May 18, 2021

Bicep version
Bicep CLI version 0.3.539 (c8b397d)

Describe the bug
After declaring a SQL Database Server resource, intelisense allows you to select incorrectly from output of the resource the property administratorLoginPassword. However this property does not exist on the output, when deployin the template (the build also allows it), you are given the following error:

The language expression property 'administratorLoginPassword' doesn't exist

To Reproduce
Create a Sql Sever resource inside a bicep template:

resource db_server 'Microsoft.Sql/servers@2020-11-01-preview' = {
  name: server_name
  location: resourceGroup().location
  tags: resourceGroup().tags
  properties: {
    administratorLogin: database_login
    administratorLoginPassword: database_password
    version: '12.0'
    publicNetworkAccess: 'Enabled'
  }
}

Use the administratorLoginPassword in any other place in the template:

var password string = db_server.administratorLoginPassword

It will allow it while on VS Code or build, but it will fail on deployment.

@ghost ghost added the Needs: Triage 🔍 label May 18, 2021
@alex-frankel
Copy link
Collaborator

Good catch - this should be marked as a secret property in swagger, but it must not be. Can you add this to #784?

@alexgman
Copy link

alexgman commented Sep 9, 2021

so what do we do if we need to use administratorLoginPassword in an ARM template??

@alex-frankel
Copy link
Collaborator

@bmoore-msft do you happen to know if there is a list*() function for sql/servers? I looked in our reference doc and don't see anything.

@bmoore-msft
Copy link
Contributor

Nothing I can find either - but it would be rare that you can retrieve a login creds via POST (I know some resources do it).

Though not sure I understand the scenario... if you need to use the pw in the template, why wouldn't you just use the database_password parameter (or keyVault)?

@ielcoro
Copy link
Author

ielcoro commented Sep 28, 2021

You could do it that way, but for simplicity when returning the output from the bicep execution we return the resources created, and as that property is defined in the resource, we expected it to be read.

However the problem I´m reporting has more to do with the fact that VS Code intellisense allows to reference it and it only fails on build, than with the fact that we can workaround its usage by passing the parameter when needed. Allowing you to choose from intellisense a property that then will fail on build is distracting and causes trust issues with the suggestions.

@bmoore-msft
Copy link
Contributor

got it... so the reference expression is created during bicep build isn't valid as that property is not part of a GET response?

@alex-frankel do we do any type checking when we create the runtime reference? Seems like either a swagger issue or we could do that checking during build (and at least warn the property isn't found)

@alex-frankel
Copy link
Collaborator

Yeah I believe it's a swagger issue. We consider it to be a readable property, but it should be marked as a secret, so we don't show it.

image

@anthony-c-martin - can you confirm? I assume this is how we are handling properly marked secrets, but don't know for sure.

@anthony-c-martin
Copy link
Member

Closed by Azure/bicep-types-az#436 - this should be fixed in the next Bicep release.

@ghost ghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants