Get an access token by using Azure CLI or Azure PowerShell

To use the FHIR® service or the DICOM® service, you need an access token that verifies your identity and permissions to the server. You can obtain an access token using PowerShell or the Azure Command-Line Interface (CLI), which are tools for creating and managing Azure resources.

Keep in mind that to access the FHIR service or the DICOM service, users and applications must be granted permissions through role assignments from Azure portal, or by using scripts.


Get an access token for the FHIR service

The FHIR service uses a specific resource or Audience with URI equal to the URI of the FHIR server https://<workspacename-fhirservicename>.fhir.azurehealthcareapis.com. Obtain a token and store it in a variable (named $token) with the following command:

token=$(az account get-access-token --resource=https://<workspacename-fhirservicename>.fhir.azurehealthcareapis.com --query accessToken --output tsv)
curl -X GET --header "Authorization: Bearer $token" https://<workspacename-fhirservicename>.fhir.azurehealthcareapis.com/Patient

Get an access token for the DICOM service

The DICOM service uses the same resource or Audience with URI equal to https://dicom.healthcareapis.azure.com to obtain an access token. Obtain a token and store it in a variable (named $token) with the following command:

token=$(az account get-access-token --resource=https://dicom.healthcareapis.azure.com --query accessToken --output tsv)
curl -X GET --header "Authorization: Bearer $token"  https://<workspacename-dicomservicename>.dicom.azurehealthcareapis.com/v<version of REST API>/changefeed

Next steps

Access the FHIR service by using Postman

Access the FHIR service by using REST client

Access the DICOM service by using cURL

Note

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

DICOM® is the registered trademark of the National Electrical Manufacturers Association for its Standards publications relating to digital communications of medical information.