Get access token using Azure CLI or Azure PowerShell
In this article, you'll learn how to obtain an access token for the FHIR service and the DICOM service using PowerShell and the Azure CLI. Keep in mind that in order to access the FHIR service or the DICOM service, users and applications must be granted permissions through role assignments from the Azure portal or using scripts. For more information about how to get started with Azure Health Data Services, see How to get started with FHIR or How to get started with DICOM.
Obtain and use 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>.azurehealthcareapis.com
. You can 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>.azurehealthcareapis.com --query accessToken --output tsv)
curl -X GET --header "Authorization: Bearer $token" https://<workspacename-fhirservicename>.azurehealthcareapis.com/Patient
Obtain and use 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. You can 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
In this article, you learned how to obtain an access token for the FHIR service and DICOM service using CLI and Azure PowerShell. For more information about accessing the FHIR service and DICOM service, see
FHIR® is a registered trademark of HL7 and is used with the permission of HL7.
Feedback
Submit and view feedback for