Skip to content

Commit 4c42418

Browse files
committed
update
1 parent c1b900f commit 4c42418

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

articles/azure-resource-manager/bicep/user-defined-data-types.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: User-defined types in Bicep
33
description: This article describes how to define and use user-defined data types in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 04/28/2025
6+
ms.date: 07/01/2025
77
---
88

99
# User-defined data types in Bicep
@@ -414,35 +414,35 @@ For more information, see [Custom tagged union data type](./data-types.md#custom
414414

415415
## Resource-derived types
416416

417-
Bicep allows you to derive types directly from Azure resource schemas using the `resourceInput<>` and `resourceOutput<>` constructs. Resource-derived types allow you to check parameters and variables against a portion of a resource body instead of with a custom type.
417+
Bicep allows you to derive types directly from Azure resource schemas using the `resourceInput<>` and `resourceOutput<>` constructs. Resource-derived types allow you to check parameters and variables against a portion of a resource body instead of with a custom type. [Bicep CLI version 0.34.1](https://github.com/Azure/bicep/releases/tag/v0.34.1) or higher is required to use these constructs.
418418

419-
Templates can reuse resource types wherever a type is expected:
419+
Templates can reuse resource types wherever a type is expected.
420420

421421
```bicep
422422
resourceInput<'type@version'>
423423
```
424424

425-
`resourceInput<>`: Represents the writable properties of a resource type, stripping away any properties marked as WriteOnly in the ARM schema. It uses the type that you would need to pass in to the resource declaration.
425+
`resourceInput<>`: Represents the writable properties of a resource type, stripping away any properties marked as ReadOnly in the ARM template schema. It uses the type that you would need to pass in to the resource declaration.
426426

427427
```bicep
428428
resourceOutput<'type@version'>
429429
```
430430

431-
`resourceOutput<>`: Represents the readable properties of a resource type, stripping away any properties marked as ReadOnly in the ARM schema. It matches the type of value returned after the resource is provisioned.
431+
`resourceOutput<>`: Represents the readable properties of a resource type, stripping away any properties marked as WriteOnly in the ARM template schema. It matches the type of value returned after the resource is provisioned.
432432

433433
You can apply `resourceInput<>` to extract only a part of a resource schema. For example, to strongly type a variable or parameter based on just the `kind` or `properties` of a storage account:
434434

435435
```bicep
436436
type accountKind = resourceInput<'Microsoft.Storage/storageAccounts@2024-01-01'>.kind
437437
```
438438

439-
This is equivalent to:
439+
The preceding example is equivalent to:
440440

441441
```bicep
442442
type accountKind = 'BlobStorage' | 'BlockBlobStorage' | 'FileStorage' | 'Storage' | 'StorageV2'
443443
```
444444

445-
The following example shows how to use `resourceInput<>` to create a strongly typed parameter based on the `properties` of a storage account resource. This allows you to define a parameter that matches the writable properties of a storage account, such as `accessTier`, `minimumTlsVersion`, and others:
445+
The following example shows how to use `resourceInput<>` to create a strongly-typed parameter based on the `properties` of a storage account resource. This allows you to define a parameter that matches the writable properties of a storage account, such as `accessTier`, `minimumTlsVersion`, and others:
446446

447447
```bicep
448448
// Strongly typed variable using the .properties path of a storage account
@@ -465,7 +465,13 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
465465
}
466466
```
467467

468-
Unlike user-defined data types, resource-derived types are checked by Bicep when editing or compiling a file, but they are not checked by the ARM service.
468+
The following example shows how to use `resourceOutput<>` to create a strongly-typed output based on the `primaryEndPoints` of a storage account resource.
469+
470+
```bicep
471+
output storageEndpoints resourceOutput<'Microsoft.Storage/storageAccounts@2024-01-01'>.properties.primaryEndpoints = ...
472+
```
473+
474+
Unlike user-defined data types, resource-derived types are checked by Bicep when editing or compiling a file, but they aren't checked by the ARM service.
469475

470476
## Related content
471477

0 commit comments

Comments
 (0)