|
1 | 1 | --- |
2 | | -title: How to create Azure Health Data Services, workspaces, and FHIR and DICOM services with BICEP |
3 | | -description: This document describes how to deploy Azure Health Data Services using Azure Bicep. |
| 2 | +title: How to deploy Azure Health Data Services services with BICEP |
| 3 | +description: This document describes how to deploy an Azure Health Data Services using Azure Bicep workspace with a FHIR and a DICOM service with BICEP. |
4 | 4 | author: chachachachami |
5 | 5 | ms.service: azure-health-data-services |
6 | 6 | ms.subservice: fhir |
7 | | -ms.topic: quickstart |
8 | | -ms.date: 02/25/2026 |
| 7 | +ms.topic: quickstart-bicep |
| 8 | +ms.date: 03/27/2026 |
9 | 9 | ms.author: chrupa |
| 10 | +ms.reviewer: v-catheribun |
10 | 11 | ms.custom: |
11 | 12 | - mode-api |
12 | 13 | - devx-track-bicep |
13 | 14 | - build-2025 |
| 15 | + - subject-bicepqs |
14 | 16 | --- |
15 | 17 |
|
16 | | -# Deploy Azure Health Data Services using Azure Bicep |
| 18 | +# Quickstart: Deploy Azure Health Data Service with Bicep |
17 | 19 |
|
18 | | -In this article, you learn how to create Azure Health Data Services, including workspaces, Fast Healthcare Interoperability Resources (FHIR) services, and Digital Imaging Communications in Medicine (DICOM) services, using Azure Bicep. |
| 20 | +In this quickstart, use a Bicep file to create an Azure Health Data Services workspace with a Fast Healthcare Interoperability Resources (FHIR) service and a Digital Imaging Communications in Medicine (DICOM) service. |
19 | 21 |
|
20 | | -## What is Azure Bicep |
| 22 | +[!INCLUDE [About Bicep](~/reusable-content/ce-skilling/azure/includes/resource-manager-quickstart-bicep-introduction.md)] |
21 | 23 |
|
22 | | -Bicep is built on top of Azure Resource Manager (ARM) template. Bicep immediately supports all preview and generally available (GA) versions for Azure services, including Azure Health Data Services. During development, you can generate a JSON ARM template file using the `az bicep build` command. Conversely, you can decompile the JSON files to Bicep using the `az bicep decompile` command. During deployment, the Bicep CLI converts a Bicep file into an ARM template JSON. |
| 24 | +## Prerequisites |
23 | 25 |
|
24 | | -You can continue to work with JSON ARM templates, or use Bicep to develop your ARM templates. For more information on Bicep, see [What is Bicep](../azure-resource-manager/bicep/overview.md). |
| 26 | +An Azure subscription. If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn). |
25 | 27 |
|
26 | | ->[!Note] |
27 | | ->The templates and scripts in the article are tested in Visual Studio Code during the public preview. Some changes may be necessary to adapt the code to run in your environment. |
| 28 | +[!INCLUDE [Azure CLI](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)] |
28 | 29 |
|
29 | | -## Define parameters and variables |
| 30 | +## Review the Bicep file |
30 | 31 |
|
31 | | -Using Bicep parameters and variables instead of hard coding names and other values allows you to debug and reuse your Bicep files. |
| 32 | +The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.healthcareapis/workspaces/create-workspace-with-child-services). |
32 | 33 |
|
33 | | -We first define parameters with the keyword *param* for workspace, FHIR service, and DICOM service. Also, we define parameters for Azure subscription and Microsoft Entra tenant. They’re used in the CLI command line with the "--parameters" option. |
34 | 34 |
|
35 | | -We then define variables for resources with the keyword *var*. Also, we define variables for properties such as the authority and the audience for the FHIR service. They’re specified and used internally in the Bicep file and can be used in combination of parameters, Bicep functions, and other variables. Unlike parameters, they aren’t used in the CLI command line. |
| 35 | +:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.healthcareapis/workspaces/create-workspace-with-child-services/main.bicep"::: |
36 | 36 |
|
37 | | -It's important to note that one Bicep function and environment are required to specify the login URL, `https://login.microsoftonline.com`. For more information on Bicep functions, see [Deployment functions for Bicep](../azure-resource-manager/bicep/bicep-functions-deployment.md#environment). |
| 37 | +The Bicep file defines three Azure resources. |
38 | 38 |
|
39 | | -``` |
40 | | -//Define parameters |
41 | | -param workspaceName string |
42 | | -param fhirName string |
43 | | -param dicomName string |
44 | | -param tenantId string |
45 | | -param location string |
46 | | -
|
47 | | -//Define variables |
48 | | -var fhirservicename = '${workspaceName}/${fhirName}' |
49 | | -var dicomservicename = '${workspaceName}/${dicomName}' |
50 | | -
|
51 | | -var loginURL = environment().authentication.loginEndpoint |
52 | | -var authority = '${loginURL}${tenantId}' |
53 | | -var audience = 'https://${workspaceName}-${fhirName}.fhir.azurehealthcareapis.com' |
54 | | -``` |
| 39 | +- [Microsoft.HealthcareApis workspaces](/azure/templates/microsoft.healthcareapis/workspaces) |
| 40 | +- [Microsoft.HealthcareApis workspaces/fhirservices](/azure/templates/microsoft.healthcareapis/workspaces/fhirservices) |
| 41 | +- [Microsoft.HealthcareApis workspaces/dicomservices](/azure/templates/microsoft.healthcareapis/workspaces/dicomservices) |
55 | 42 |
|
56 | | -## Create a workspace template |
57 | 43 |
|
58 | | -To define a resource, use the keyword *resource*. For the workspace resource, the required properties include the workspace name and location. In the template, the location of the resource group is used, but you can specify a different value for the location. For the resource name, you can reference the defined parameter or variable. |
59 | 44 |
|
60 | | -For more information on resource and module, see [Resource declaration in Bicep](../azure-resource-manager/bicep/resource-declaration.md). |
| 45 | +## Prepare your environment |
61 | 46 |
|
62 | | -``` |
63 | | -//Create a workspace |
64 | | -resource exampleWorkspace 'Microsoft.HealthcareApis/workspaces@2021-06-01-preview' = { |
65 | | - name: workspaceName |
66 | | - location: resourceGroup().location |
67 | | -} |
68 | | -``` |
| 47 | +You can deploy the Bicep file by using Azure CLI or Azure PowerShell. This example uses Azure CLI in Bash. |
69 | 48 |
|
70 | | -To use or reference an existing workspace without creating one, use the keyword *existing*. Specify the workspace resource name and the existing workspace instance name for the name property. A different name for the existing workspace resource is used in the template, but that isn't a requirement. |
71 | | - |
72 | | -``` |
73 | | -//Use an existing workspace |
74 | | -resource exampleExistingWorkspace 'Microsoft.HealthcareApis/workspaces@2021-06-01-preview' existing = { |
75 | | - name: workspaceName |
76 | | -} |
77 | | -``` |
| 49 | +1. Save your Bicep file locally as `main.bicep`. |
| 50 | +1. Open a Bash shell and go to the directory where you saved the Bicep file. |
| 51 | +1. Run the following command to sign in to Azure from the CLI. Follow the prompts to complete the authentication process. |
| 52 | + |
| 53 | + ```azurecli |
| 54 | + az login |
| 55 | + ``` |
| 56 | +1. Run the upgrade command to make sure you're running the latest version of Azure CLI. |
78 | 57 |
|
79 | | -You're now ready to deploy the workspace resource using the `az deployment group create` command. You can also deploy it along with its other resources, as described further later in this article. |
| 58 | + ```azurecli |
| 59 | + az upgrade |
| 60 | + ``` |
80 | 61 |
|
81 | | -## Create a FHIR service template |
| 62 | +## Create resource group |
82 | 63 |
|
83 | | -For the FHIR service resource, the required properties include service instance name, location, kind, and managed identity. Also, it has a dependency on the workspace resource. For the FHIR service itself, the required properties include authority and audience, which are specified in the properties element. |
| 64 | +Use the [az group create](/cli/azure/group#az-group-create) command to create a resource group. Replace the `<placeholders>` with your values. |
84 | 65 |
|
| 66 | +```azurecli |
| 67 | +az group create --name <resource group name> --location westus2 |
85 | 68 | ``` |
86 | | -resource exampleFHIR 'Microsoft.HealthcareApis/workspaces/fhirservices@2021-11-01' = { |
87 | | - name: fhirservicename |
88 | | - location: resourceGroup().location |
89 | | - kind: 'fhir-R4' |
90 | | - identity: { |
91 | | - type: 'SystemAssigned' |
92 | | - } |
93 | | - dependsOn: [ |
94 | | - exampleWorkspace |
95 | | - //exampleExistingWorkspace |
96 | | - ] |
97 | | - properties: { |
98 | | - accessPolicies: [] |
99 | | - authenticationConfiguration: { |
100 | | - authority: authority |
101 | | - audience: audience |
102 | | - smartProxyEnabled: false |
103 | | - } |
104 | | - } |
105 | | -} |
106 | | -``` |
107 | | - |
108 | | -Similarly, you can use or reference an existing FHIR service using the keyword *existing*. |
109 | 69 |
|
110 | | -``` |
111 | | -//Use an existing FHIR service |
112 | | -resource exampleExistingFHIR 'Microsoft.HealthcareApis/workspaces/fhirservices@2021-11-01' existing = { |
113 | | - name: fhirservicename |
114 | | -} |
115 | | -``` |
| 70 | +## Deploy resources |
116 | 71 |
|
117 | | -## Create a DICOM service template |
| 72 | +Use the [az deployment group create](/cli/azure/deployment/group#az-deployment-group-create) command to deploy your resources. Replace the `<placeholders>` with your values. |
118 | 73 |
|
119 | | -For the DICOM service resource, the required properties include service instance name and location, and the dependency on the workspace resource type. |
| 74 | +```azurecli |
| 75 | +az deployment group create --resource-group <resource group name> --template-file main.bicep |
120 | 76 |
|
121 | 77 | ``` |
122 | | -//Create DICOM service |
123 | | -resource exampleDICOM 'Microsoft.HealthcareApis/workspaces/dicomservices@2021-11-01' = { |
124 | | - name: dicomservicename |
125 | | - location: resourceGroup().location |
126 | | - dependsOn: [ |
127 | | - exampleWorkspace |
128 | | - ] |
129 | | - properties: {} |
130 | | -} |
131 | | -``` |
132 | | - |
133 | | -Similarly, you can use or reference an existing DICOM service using the keyword *existing*. |
134 | 78 |
|
135 | | -``` |
136 | | -//Use an existing DICOM service |
137 | | - resource exampleExistingDICOM 'Microsoft.HealthcareApis/workspaces/dicomservices@2021-11-01' existing = { |
138 | | - name: dicomservicename |
139 | | -} |
140 | | -``` |
| 79 | +The output of this command is a JSON-formatted listing of the deployment. You can view and manage these resources through the [az healthcareapis workspace](/cli/azure/healthcareapis/workspace) commands. |
141 | 80 |
|
142 | | -## Deploy Azure Health Data Services |
| 81 | +## Debug Bicep files |
143 | 82 |
|
144 | | -You can use the `az deployment group create` command to deploy individual Bicep file or combined templates, similar to the way you deploy Azure resources with JSON templates. Specify the resource group name, and include the parameters in the command line. With the "--parameters" option, specify the parameter and value pair as "parameter = value", and separate the parameter and value pairs by a space if more than one parameter is defined. |
| 83 | +You can debug Bicep files in Visual Studio Code or in other environments. Troubleshoot issues based on the response. You can also review the activity log for a specific resource in the resource group while debugging. |
145 | 84 |
|
146 | | -For the Azure subscription and tenant, you can specify the values, or use CLI commands to obtain them from the current sign-in session. |
| 85 | +In addition, you can use the **output** value for debugging or as part of the deployment response. For example, you can define two output values to display the values of authority and audience for the FHIR service in the response. For more information, see [Outputs in Bicep](../azure-resource-manager/bicep/outputs.md). |
147 | 86 |
|
148 | 87 | ``` |
149 | | -deploymentname=xxx |
150 | | -resourcegroupname=rg-$deploymentname |
151 | | -location=centralus |
152 | | -workspacename=ws$deploymentname |
153 | | -fhirname=fhir$deploymentname |
154 | | -dicomname=dicom$deploymentname |
155 | | -bicepfilename=ahds.bicep |
156 | | -subscriptionid=$(az account show --query id --output tsv) |
157 | | -tenantid=$(az account show --subscription $subscriptionid --query tenantId --output tsv) |
158 | | -
|
159 | | -az group create --name $resourcegroupname --location $location |
160 | | -az deployment group create --resource-group $resourcegroupname --template-file $bicepfilename --parameters workspaceName=$workspacename fhirName=$fhirname dicomName=$dicomname tenantId=$tenantid location=$location |
| 88 | +output stringOutput1 string = authority |
| 89 | +output stringOutput2 string = audience |
161 | 90 | ``` |
162 | 91 |
|
163 | | -The child resource name such as the FHIR service includes the parent resource name, and the "dependsOn" property is required. However, when the child resource is created within the parent resource, its name doesn't need to include the parent resource name, and the "dependsOn" property isn't required. For more info on nested resources, see [Set name and type for child resources in Bicep](../azure-resource-manager/bicep/child-resource-name-type.md). |
164 | | - |
165 | | -## Debugging Bicep files |
| 92 | +## Clean up resources |
166 | 93 |
|
167 | | -You can debug Bicep files in Visual Studio Code, or in other environments and troubleshoot issues based on the response. Also, you can review the activity log for a specific resource in the resource group while debugging. |
| 94 | +When you're finished with the resources you created, delete the resource group. Deleting the resource group deletes all the resources created in this exercise. To delete the resource group, run the [az group delete](/cli/azure/group#az-group-delete) command. Replace the `<placeholders>` with your values. |
168 | 95 |
|
169 | | -In addition, you can use the **output** value for debugging or as part of the deployment response. For example, you can define two output values to display the values of authority and audience for the FHIR service in the response. For more information, see [Outputs in Bicep](../azure-resource-manager/bicep/outputs.md). |
170 | | - |
171 | | -``` |
172 | | -output stringOutput1 string = authority |
173 | | -output stringOutput2 string = audience |
| 96 | +```azurecli |
| 97 | +az group delete --resource-group <resource group name> |
174 | 98 | ``` |
175 | 99 |
|
176 | 100 | ## Next steps |
177 | 101 |
|
178 | | -In this article, you learned how to create Azure Health Data Services, including workspaces, FHIR services, and DICOM services using Bicep. You also learned how to create and debug Bicep files. For more information about Azure Health Data Services, see: |
179 | | - |
180 | 102 | >[!div class="nextstepaction"] |
181 | | ->[What is Azure Health Data Services?](healthcare-apis-overview.md) |
| 103 | +>[Manage user access and permissions](authentication-authorization.md) |
| 104 | +
|
| 105 | +[!INCLUDE [FHIR and DICOM trademark statement](./includes/healthcare-apis-fhir-dicom-trademark.md)] |
182 | 106 |
|
183 | | -FHIR® is a registered trademark of [HL7](https://hl7.org/fhir/) and is used with the permission of HL7. |
0 commit comments