Skip to content

Use resource types for parameter validation #9229

@jeskew

Description

@jeskew

Is your feature request related to a problem? Please describe.
With the user-defined types preview enabled, users can declare custom types and validate that parameters match those type declarations. If a parameter value is passed directly to a resource as a property, however, users need to re-declare the existing type definition as type symbols within their template (or forgo validation).

Describe the solution you'd like
It should be possible to use an existing resource type (or portion thereof) from a built-in or imported namespace. This could be accomplished via typeof function or keyword, such as in typeof('Microsoft.KeyVault/vaults@2022-07-01#properties.accessPolicies[*]').

If we want to leave room for a similar function that gets the assigned type of a variable or parameter, we might need two functions or to require the resource keyword:

param foo { bar: string }
param bar typeof(foo).bar
param accessPolicy typeof(resource 'Microsoft.KeyVault/vaults@2022-07-01').properties.accessPolicies[*]

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions