You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, just curious, is this a known restriction within bicep or am I missing something? I'm trying to deploy an AVD host pool, I'm using a hostPoolProperties type with an optional friendlyName string. See below
I'm validating that the string may be null, and if so, it won't be used within the deployment.
I'm then calling the bicep file via a module that isn't specifying the friendlyName attribute because it's optional. Is the error expected?
The text was updated successfully, but these errors were encountered:
The expression empty(hostPoolObject.friendlyName) is what is failing at runtime because attempting to access a missing property in ARM will raise an error. There's an explanation for why ARM behaves this way in #11912 (comment)
Bicep introduced the .? (safe dereference) to try to help with this. empty(hostPoolObject.?friendlyName) will return false if the friendlyName property is missing, null, or an empty string (hostPoolObject.?friendlyName will evaluate to null if the property is missing).
It might help to have a linter rule that emits a warning diagnostic with a quick fix to replace a . (property access) operator with a .? operator if the accessed property is nullable.
Hi, just curious, is this a known restriction within bicep or am I missing something? I'm trying to deploy an AVD host pool, I'm using a hostPoolProperties type with an optional friendlyName string. See below
I'm validating that the string may be null, and if so, it won't be used within the deployment.
I'm then calling the bicep file via a module that isn't specifying the friendlyName attribute because it's optional. Is the error expected?
The text was updated successfully, but these errors were encountered: