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
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/user-defined-data-types.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: User-defined types in Bicep
3
3
description: This article describes how to define and use user-defined data types in Bicep.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 04/28/2025
6
+
ms.date: 07/01/2025
7
7
---
8
8
9
9
# User-defined data types in Bicep
@@ -414,35 +414,35 @@ For more information, see [Custom tagged union data type](./data-types.md#custom
414
414
415
415
## Resource-derived types
416
416
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.
418
418
419
-
Templates can reuse resource types wherever a type is expected:
419
+
Templates can reuse resource types wherever a type is expected.
420
420
421
421
```bicep
422
422
resourceInput<'type@version'>
423
423
```
424
424
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.
426
426
427
427
```bicep
428
428
resourceOutput<'type@version'>
429
429
```
430
430
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.
432
432
433
433
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:
434
434
435
435
```bicep
436
436
type accountKind = resourceInput<'Microsoft.Storage/storageAccounts@2024-01-01'>.kind
The following example shows how to use `resourceInput<>` to create a stronglytyped 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:
446
446
447
447
```bicep
448
448
// Strongly typed variable using the .properties path of a storage account
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.
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.
0 commit comments