Quickstart: Deploy Azure API for FHIR using Azure CLI

In this quickstart, you'll learn how to deploy Azure API for FHIR in Azure using the Azure CLI.

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

Use 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 block. Selecting Try It doesn't automatically copy the code to Cloud Shell. 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. Launch Cloud Shell in a new window
Select the Cloud Shell button on the top-right menu bar in the Azure portal. Cloud Shell button in the Azure portal

To run the code in this article in Azure Cloud Shell:

  1. Start Cloud Shell.

  2. Select the Copy button on a code block to copy the code.

  3. Paste the code 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.

Add HealthcareAPIs extension

az extension add --name healthcareapis

Get a list of commands for HealthcareAPIs:

az healthcareapis --help

Locate your identity object ID

Object ID values are guids that correspond to the object IDs of specific Azure Active Directory users or service principals in the directory associated with the subscription. If you would like to know the object ID of a specific user, you can find it with a command like:

az ad user show --id myuser@consoso.com | jq -r .objectId

Read the how-to guide on finding identity object IDs for more details.

Create Azure Resource Group

Pick a name for the resource group that will contain the Azure API for FHIR and create it:

az group create --name "myResourceGroup" --location westus2

Deploy the Azure API for FHIR

az healthcareapis create --resource-group myResourceGroup --name nameoffhiraccount --kind fhir-r4 --location westus2 --access-policies-object-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

where xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is the identity object ID for a user or service principal that you would like to have access to the FHIR API.

Fetch FHIR API capability statement

Obtain a capability statement from the FHIR API with:

curl --url "https://nameoffhiraccount.azurehealthcareapis.com/metadata"

Clean up resources

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

az group delete --name "myResourceGroup"

Next steps

In this tutorial, you've deployed the Azure API for FHIR into your subscription. To set additional settings in your Azure API for FHIR, proceed to the additional settings tutorial.