|
| 1 | +--- |
| 2 | +title: Deploy the MedTech service using a Bicep file and Azure PowerShell or Azure CLI - Azure Health Data Services |
| 3 | +description: In this quickstart, you'll learn how to deploy the MedTech service using a Bicep file and Azure PowerShell or Azure CLI |
| 4 | +author: msjasteppe |
| 5 | +ms.service: healthcare-apis |
| 6 | +ms.subservice: fhir |
| 7 | +ms.topic: quickstart |
| 8 | +ms.date: 11/28/2022 |
| 9 | +ms.author: jasteppe |
| 10 | +--- |
| 11 | + |
| 12 | +# Quickstart: Deploy the MedTech service using a Bicep file and Azure PowerShell or Azure CLI |
| 13 | + |
| 14 | +In this quickstart, you'll learn how to: |
| 15 | + |
| 16 | +> [!div class="checklist"] |
| 17 | +> - Use Azure PowerShell or Azure CLI to deploy an instance of the MedTech service using a Bicep file. |
| 18 | +
|
| 19 | +Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. In a Bicep file, you define the infrastructure you want to deploy to Azure, and then use that file throughout the development lifecycle to repeatedly deploy your infrastructure. Your resources are deployed in a consistent manner. |
| 20 | + |
| 21 | +Bicep provides concise syntax, reliable type safety, and support for code reuse. Bicep offers a first-class authoring experience for your infrastructure-as-code solutions in Azure. |
| 22 | + |
| 23 | +For more information about Bicep, see [What is Bicep?](/azure/azure-resource-manager/bicep/overview?tabs=bicep) |
| 24 | + |
| 25 | +## Deployment prerequisites |
| 26 | + |
| 27 | +To begin your deployment and complete the quickstart, you must have the following prerequisites: |
| 28 | + |
| 29 | +- An active Azure subscription account. If you don't have an Azure subscription, see [Subscription decision guide](/azure/cloud-adoption-framework/decision-guides/subscriptions/). |
| 30 | + |
| 31 | +- Owner or Contributor and User Access Administrator role assignments in the Azure subscription. For more information, see [What is Azure role-based access control?](../../role-based-access-control/overview.md) |
| 32 | + |
| 33 | +- The Microsoft.HealthcareApis and Microsoft.EventHub resource providers registered with your Azure subscription. To learn more about registering resource providers, see [Azure resource providers and types](../../azure-resource-manager/management/resource-providers-and-types.md). |
| 34 | + |
| 35 | +- [Azure PowerShell](/powershell/azure/install-az-ps) and/or [Azure CLI](/cli/azure/install-azure-cli) installed locally. |
| 36 | + - For Azure PowerShell, you'll also need to install [Bicep CLI](/azure/azure-resource-manager/bicep/install#windows) to deploy the Bicep file used in this quickstart. |
| 37 | + |
| 38 | +When you have these prerequisites, you're ready to deploy the Bicep file. |
| 39 | + |
| 40 | +## Review the Bicep file |
| 41 | + |
| 42 | +The Bicep file used for this deployment is available from the [Azure Quickstart Templates](/samples/azure/azure-quickstart-templates/iotconnectors/) site using the `main.bicep` file located on [GitHub](https://github.com/azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.healthcareapis/workspaces/iotconnectors/). |
| 43 | + |
| 44 | +Locally save the Bicep file as `main.bicep`. You'll need to have the working directory of your Azure PowerShell or Azure CLI console pointing to the location where this file is saved. |
| 45 | + |
| 46 | +## Deploy the MedTech service with the Bicep file and Azure PowerShell |
| 47 | + |
| 48 | +Complete the following five steps to deploy the MedTech service using Azure PowerShell: |
| 49 | + |
| 50 | +1. Sign-in into Azure. |
| 51 | + |
| 52 | + ```azurepowershell |
| 53 | + Connect-AzAccount |
| 54 | + ``` |
| 55 | + |
| 56 | +2. Set your Azure subscription deployment context using your subscription ID. To learn how to get your subscription ID, see [Get subscription and tenant IDs in the Azure portal](/azure/azure-portal/get-subscription-tenant-id). |
| 57 | + |
| 58 | + ```azurepowershell |
| 59 | + Set-AzContext <AzureSubscriptionId> |
| 60 | + ``` |
| 61 | + |
| 62 | + For example: `Set-AzContext abcdef01-2345-6789-0abc-def012345678` |
| 63 | + |
| 64 | +3. Confirm the location you want to deploy in. See the [Products available by region](https://azure.microsoft.com/global-infrastructure/services/?products=health-data-services) site for the current Azure regions where Azure Health Data Services is available. |
| 65 | + |
| 66 | + You can also review the **location** section of the locally saved `main.bicep` file. |
| 67 | + |
| 68 | + If you need a list of the Azure regions location names, you can use this code to display a list: |
| 69 | + |
| 70 | + ```azurepowershell |
| 71 | + Get-AzLocation | Format-Table -Property DisplayName,Location |
| 72 | + ``` |
| 73 | + |
| 74 | +4. If you don't already have a resource group created for this quickstart, you can use this code to create one: |
| 75 | + |
| 76 | + ```azurepowershell |
| 77 | + New-AzResourceGroup -name <ResourceGroupName> -location <AzureRegion> |
| 78 | + ``` |
| 79 | + |
| 80 | + For example: `New-AzResourceGroup -name BicepTestDeployment -location southcentralus` |
| 81 | + |
| 82 | + > [!IMPORTANT] |
| 83 | + > For a successful deployment of the MedTech service, you'll need to use numbers and lowercase letters for the basename of your resources. The minimum basename requirement is three characters with a maximum of 16 characters. |
| 84 | +
|
| 85 | +5. Use the following code to deploy the MedTech service using the Bicep file: |
| 86 | + |
| 87 | + ```azurepowershell |
| 88 | + New-AzResourceGroupDeployment -ResourceGroupName <ResourceGroupName> -TemplateFile main.bicep -basename <BaseName> -location <AzureRegion> |
| 89 | + ``` |
| 90 | + |
| 91 | + For example: `New-AzResourceGroupDeployment -ResourceGroupName BicepTestDeployment -TemplateFile main.bicep -basename abc123 -location southcentralus` |
| 92 | + |
| 93 | +## Deploy the MedTech service with the Bicep file and Azure CLI |
| 94 | + |
| 95 | +Complete the following six steps to deploy the MedTech service using Azure CLI: |
| 96 | + |
| 97 | +1. Sign-in into Azure. |
| 98 | + |
| 99 | + ```azurecli |
| 100 | + az login |
| 101 | + ``` |
| 102 | +2. Set your Azure subscription deployment context using your subscription ID. To learn how to get your subscription ID, see [Get subscription and tenant IDs in the Azure portal](/azure/azure-portal/get-subscription-tenant-id). |
| 103 | + |
| 104 | + ```azurecli |
| 105 | + az account set <AzureSubscriptionId> |
| 106 | + ``` |
| 107 | + |
| 108 | + For example: `az account set abcdef01-2345-6789-0abc-def012345678` |
| 109 | + |
| 110 | +3. Confirm the location you want to deploy in. See the [Products available by region](https://azure.microsoft.com/global-infrastructure/services/?products=health-data-services) site for the current Azure regions where Azure Health Data Services is available. |
| 111 | + |
| 112 | + You can also review the **location** section of the locally saved `main.bicep` file. |
| 113 | + |
| 114 | + If you need a list of the Azure regions location names, you can use this code to display a list: |
| 115 | + |
| 116 | + ```azurecli |
| 117 | + az account list-locations -o table |
| 118 | + ``` |
| 119 | + |
| 120 | +4. If you don't already have a resource group created for this quickstart, you can use this code to create one: |
| 121 | + |
| 122 | + ```azurecli |
| 123 | + az group create --resource-group <ResourceGroupName> --location <AzureRegion> |
| 124 | + ``` |
| 125 | + |
| 126 | + For example: `az group create --resource-group BicepTestDeployment --location southcentralus` |
| 127 | + |
| 128 | + > [!IMPORTANT] |
| 129 | + > For a successful deployment of the MedTech service, you'll need to use numbers and lowercase letters for the basename of your resources. |
| 130 | +
|
| 131 | +5. Use the following code to deploy the MedTech service using the Bicep file: |
| 132 | + |
| 133 | + ```azurecli |
| 134 | + az deployment group create --resource-group BicepTestDeployment --template-file main.bicep --parameters basename=<BaseName> location=<AzureRegion> |
| 135 | + ``` |
| 136 | + |
| 137 | + For example: `az deployment group create --resource-group BicepTestDeployment --template-file main.bicep --parameters basename=abc location=southcentralus` |
| 138 | + |
| 139 | +## Review deployed resources and access permissions |
| 140 | + |
| 141 | +When deployment is completed, the following resources and access roles are created in the Bicep file deployment: |
| 142 | + |
| 143 | +- Azure Event Hubs namespace and device message event hub. In this deployment, the device message event hub is named `devicedata`. |
| 144 | + |
| 145 | +- An event hub consumer group. In this deployment, the consumer group is named `$Default`. |
| 146 | + |
| 147 | +- The Azure Event Hubs Data Sender role. In this deployment, the sender role is named `devicedatasender`. |
| 148 | + |
| 149 | +- A Health Data Services workspace. |
| 150 | + |
| 151 | +- A Health Data Services Fast Healthcare Interoperability Resources (FHIR®) service. |
| 152 | + |
| 153 | +- An instance of the MedTech service for Health Data Services, with the required [system-assigned managed identity](../../active-directory/managed-identities-azure-resources/overview.md) roles: |
| 154 | + |
| 155 | + - For the device message event hub, the Azure Events Hubs Data Receiver role is assigned in the [Access control section (IAM)](../../role-based-access-control/overview.md) of the device message event hub. |
| 156 | + |
| 157 | + - For the FHIR service, the FHIR Data Writer role is assigned in the [Access control section (IAM)](../../role-based-access-control/overview.md) of the FHIR service. |
| 158 | + |
| 159 | +## Post-deployment mappings |
| 160 | + |
| 161 | +After you've successfully deployed an instance of the MedTech service, you'll still need to provide conforming and valid device and FHIR destination mappings. |
| 162 | + |
| 163 | + - To learn more about device mappings, see [How to configure device mappings](how-to-use-device-mappings.md). |
| 164 | + |
| 165 | + - To learn more about FHIR destination mappings, see [How to configure FHIR destination mappings](how-to-use-fhir-mappings.md). |
| 166 | + |
| 167 | +## Clean up Azure PowerShell deployed resources |
| 168 | + |
| 169 | +When your resource group and deployed Bicep file resources are no longer needed, delete the resource group, which deletes the resources in the resource group. |
| 170 | + |
| 171 | +```azurepowershell |
| 172 | +Remove-AzResourceGroup -Name <ResourceGroupName> |
| 173 | + ``` |
| 174 | + |
| 175 | +For example: `Remove-AzResourceGroup -Name BicepTestDeployment` |
| 176 | + |
| 177 | +## Clean up Azure CLI deployed resources |
| 178 | + |
| 179 | +When your resource group and deployed Bicep file resources are no longer needed, delete the resource group, which deletes the resources in the resource group. |
| 180 | + |
| 181 | +```azurecli |
| 182 | +az group delete --name <ResourceGroupName> |
| 183 | +``` |
| 184 | + |
| 185 | +For example: `az group delete --resource-group BicepTestDeployment` |
| 186 | + |
| 187 | +> [!TIP] |
| 188 | +> For a step-by-step tutorial that guides you through the process of creating a Bicep file, see [Build your first Bicep template](/training/modules/build-first-bicep-template/). |
| 189 | +
|
| 190 | +## Next steps |
| 191 | + |
| 192 | +In this article, you learned how to use Azure PowerShell or Azure CLI to deploy an instance of the MedTech service using a Bicep file. To learn more about other methods of deploying the MedTech service, see |
| 193 | + |
| 194 | +> [!div class="nextstepaction"] |
| 195 | +> [Choosing a method of deployment for the MedTech service in Azure](deploy-iot-connector-in-azure.md) |
| 196 | +
|
| 197 | +> [!div class="nextstepaction"] |
| 198 | +> [How to deploy the MedTech service with a Azure Resource Manager template](deploy-02-new-button.md) |
| 199 | +
|
| 200 | +> [!div class="nextstepaction"] |
| 201 | +> [How to manually deploy the MedTech service with Azure portal](deploy-03-new-manual.md) |
| 202 | +
|
| 203 | +FHIR® is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. |
0 commit comments