Quickstart: Deploy Azure API for FHIR using PowerShell

Important

Azure API for FHIR will be retired on September 30, 2026. Follow the migration strategies to transition to Azure Health Data Services FHIR® service by that date. Due to the retirement of Azure API for FHIR, new deployments won't be allowed beginning April 1, 2025. Azure Health Data Services FHIR service is the evolved version of Azure API for FHIR that enables customers to manage FHIR, DICOM, and MedTech services with integrations into other Azure services.

In this quickstart, you learn how to deploy Azure API for FHIR using PowerShell.

If you don't have an Azure subscription, create a free account before you begin.

Azure Cloud Shell

Azure hosts Azure Cloud Shell, an interactive shell environment that you can use through your browser. You can use either Bash or PowerShell with Cloud Shell to work with Azure services. You can use the Cloud Shell preinstalled commands to run the code in this article, without having to install anything on your local environment.

To start Azure Cloud Shell:

Option Example/Link
Select Try It in the upper-right corner of a code or command block. Selecting Try It doesn't automatically copy the code or command to Cloud Shell. Screenshot that shows an example of Try It for Azure Cloud Shell.
Go to https://shell.azure.com, or select the Launch Cloud Shell button to open Cloud Shell in your browser. Button to launch Azure Cloud Shell.
Select the Cloud Shell button on the menu bar at the upper right in the Azure portal. Screenshot that shows the Cloud Shell button in the Azure portal

To use Azure Cloud Shell:

  1. Start Cloud Shell.

  2. Select the Copy button on a code block (or command block) to copy the code or command.

  3. Paste the code or command into the Cloud Shell session by selecting Ctrl+Shift+V on Windows and Linux, or by selecting Cmd+Shift+V on macOS.

  4. Select Enter to run the code or command.

Note

We recommend that you use the Azure Az PowerShell module to interact with Azure. To get started, see Install Azure PowerShell. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

Register the Azure API for FHIR resource provider

If the Microsoft.HealthcareApis resource provider isn't already registered for your subscription, you can register it with the following command.

Register-AzResourceProvider -ProviderNamespace Microsoft.HealthcareApis

Create Azure resource group

New-AzResourceGroup -Name "myResourceGroupName" -Location westus2

Deploy Azure API for FHIR

New-AzHealthcareApisService -Name nameoffhirservice -ResourceGroupName myResourceGroupName -Location westus2 -Kind fhir-R4

Note

Depending on the version of the Az PowerShell module you have installed, the provisioned FHIR server may be configured to use local role-based access control (RBAC) and have the currently signed in PowerShell user in the list of allowed identity object IDs for the deployed FHIR service. We recommend you use Azure RBAC for assigning data plane roles. You may need to delete this user's object ID after deployment to enable Azure RBAC mode.

Fetch capability statement

You can validate that the Azure API for FHIR account is running by fetching a FHIR capability statement with the following commands.

$metadata = Invoke-WebRequest -Uri "https://nameoffhirservice.azurehealthcareapis.com/metadata"
$metadata.RawContent

Clean up resources

If you're not going to continue using this application, delete the resource group with the following steps.

Remove-AzResourceGroup -Name myResourceGroupName

Next steps

In this quickstart guide, you deployed the Azure API for FHIR into your subscription. For more information about the settings in Azure API for FHIR and to start using Azure API for FHIR, see

Note

FHIR® is a registered trademark of HL7 and is used with the permission of HL7.