Bagikan melalui


Menyebarkan layanan FHIR dalam Azure Health Data Services - menggunakan templat ARM

Dalam artikel ini, Anda akan mempelajari cara menyebarkan layanan FHIR® dalam Azure Health Data Services menggunakan templat Azure Resource Manager (templat ARM). Kami menyediakan dua opsi: menggunakan PowerShell atau menggunakan CLI.

Templat ARM adalah file JSON yang menentukan infrastruktur dan konfigurasi untuk proyek Anda. Template tersebut menggunakan sintaksis deklaratif. Dalam sintaksis deklaratif, Anda menguraikan penyebaran yang Anda maksudkan tanpa menulis urutan perintah pemrograman untuk membuat penyebaran tersebut.

Prasyarat

Meninjau templat ARM

Templat yang digunakan dalam artikel ini berasal dari Templat Azure Quickstart.

Templat menentukan tiga sumber daya Azure:

  • Microsoft.HealthcareApis/workspaces
  • Microsoft.HealthcareApis/workspaces/fhirservices
  • Microsoft.Storage/storageAccounts

Catatan

RBAC lokal tidak digunakan lagi. Konfigurasi Kebijakan Akses yang terkait dengan RBAC Lokal dalam templat ARM tidak digunakan lagi. Pelanggan yang sudah ada yang menggunakan RBAC Lokal perlu bermigrasi ke Azure RBAC pada November 2024. Untuk pertanyaan, silakan hubungi kami.

Anda dapat menyebarkan sumber daya layanan FHIR dengan menghapus sumber daya ruang kerja, sumber daya penyimpanan, dan dependsOn properti di sumber daya "Microsoft.HealthcareApis/workspaces/fhirservices".

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "authorityurl": {
            "type": "string",
            "defaultValue": "https://login.microsoftonline.com"
        },
        "tagName": {
            "type": "string",
            "defaultValue": "My Deployment"
        },
        "region": {
            "type": "string",
                  "allowedValues": [
                "australiaeast",
                "canadacentral",
                "eastus",
                "eastus2",
                "germanywestcentral",
                "japaneast",
                "northcentralus",
                "northeurope",
                "southafricanorth",
                "southcentralus",
                "southeastasia",
                "switzerlandnorth",
                "uksouth",
                "ukwest",
                "westcentralus",
                "westeurope",
                "westus2"
            ]
        },
        "workspaceName": {
            "type": "string"
        },
        "fhirServiceName": {
            "type": "string"
        },
        "tenantid": {
            "type": "string"
        },
        "storageAccountName": {
            "type": "string"
        },
        "storageAccountConfirm": {
            "type": "bool",
            "defaultValue": true
        },
        "AccessPolicies": {
            "type": "array",
            "defaultValue": []
        },
        "smartProxyEnabled": {
            "type": "bool",
            "defaultValue": false
        }
    },
    "variables": { 
        "authority": "[Concat(parameters('authorityurl'), '/', parameters('tenantid'))]",
        "createManagedIdentity": true,
        "managedIdentityType": {
            "type": "SystemAssigned"
        },
        "storageBlobDataContributerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]"
    },
    "resources": [
        {
            "type": "Microsoft.HealthcareApis/workspaces",
            "name": "[parameters('workspaceName')]",
            "apiVersion": "2023-11-01",
            "location": "[parameters('region')]",
            "properties": {}
        },
       {          
            "type": "Microsoft.HealthcareApis/workspaces/fhirservices",
            "kind": "fhir-R4",
            "name": "[concat(parameters('workspaceName'), '/', parameters('fhirServiceName'))]",
            "apiVersion": "2023-11-01",
            "location": "[parameters('region')]",
            "dependsOn": [
                "[resourceId('Microsoft.HealthcareApis/workspaces', parameters('workspaceName'))]"
            ],
            "tags": {
                "environmentName": "[parameters('tagName')]"
            },
            "properties": {
                "accessPolicies": "[parameters('AccessPolicies')]",
                "authenticationConfiguration": {
                    "authority": "[variables('Authority')]",
                    "audience": "[concat('https//', parameters('workspaceName'), '-', parameters('fhirServiceName'), '.fhir.azurehealthcareapis.com')]",
                    "smartProxyEnabled": "[parameters('smartProxyEnabled')]"
                },
                "corsConfiguration": {
                    "allowCredentials": false,
                    "headers": ["*"],
                    "maxAge": 1440,
                    "methods": ["DELETE", "GET", "OPTIONS", "PATCH", "POST", "PUT"],
                    "origins": ["https://localhost:6001"]
                },
                "exportConfiguration": {
                    "storageAccountName": "[parameters('storageAccountName')]"
                }
            },
            "identity": "[if(variables('createManagedIdentity'), variables('managedIdentityType'), json('null'))]"
        },
        {
            "name": "[parameters('storageAccountName')]",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2019-06-01",
            "location": "[resourceGroup().location]",
            "properties": {
                "supportsHttpsTrafficOnly": "true"
            },
            "condition": "[parameters('storageAccountConfirm')]",
            "dependsOn": [
                "[parameters('fhirServiceName')]"
            ],
            "sku": {
                "name": "Standard_LRS"
            },
            "kind": "Storage",
            "tags": {
                "environmentName": "[parameters('tagName')]",
                "test-account-rg": "true"
            }
        }
    ],
    "outputs": {
    }
}

Menyebarkan templat ARM

Anda dapat menyebarkan templat ARM menggunakan dua opsi: PowerShell atau CLI.

Kode sampel berikut menggunakan templat di subfolder "templat" subfolder "src". Anda mungkin ingin mengubah jalur lokasi untuk mereferensikan file templat dengan benar.

Proses penyebaran membutuhkan waktu beberapa menit untuk diselesaikan. Catat nama untuk layanan FHIR dan grup sumber daya, yang Anda gunakan nanti.

Menyebarkan templat: menggunakan PowerShell

Untuk menyebarkan layanan FHIR, jalankan kode di PowerShell secara lokal, di Visual Studio Code, atau di Azure Cloud Shell.

Jika Anda belum masuk ke Azure, gunakan "Connect-AzAccount" untuk masuk. Setelah Anda masuk, gunakan "Get-AzContext" untuk memverifikasi langganan dan penyewa yang ingin Anda gunakan. Anda dapat mengubah langganan dan penyewa jika diperlukan.

Anda dapat membuat grup sumber daya baru, atau menggunakan yang sudah ada dengan melewati langkah, atau mengomentari baris yang dimulai dengan "New-AzResourceGroup".

### variables
$resourcegroupname="your resource group"
$location="South Central US"
$workspacename="your workspace name"
$fhirservicename="your fhir service name"
$tenantid="xxx"
$subscriptionid="xxx"
$storageaccountname="storage account name"
$storageaccountconfirm=1

### login to azure
Connect-AzAccount 
#Connect-AzAccount SubscriptionId $subscriptionid
Set-AzContext -Subscription $subscriptionid
Connect-AzAccount -Tenant $tenantid -SubscriptionId $subscriptionid
#Get-AzContext 

### create resource group
New-AzResourceGroup -Name $resourcegroupname -Location $location

### deploy the resource
New-AzResourceGroupDeployment -ResourceGroupName $resourcegroupname -TemplateFile "src/templates/fhirtemplate.json" -region $location -workspaceName $workspacename -fhirServiceName $fhirservicename -tenantid $tenantid -storageAccountName $storageaccountname -storageAccountConfirm $storageaccountconfirm

Tinjau sumber daya yang digunakan

Anda dapat memverifikasi bahwa layanan FHIR aktif dan berjalan dengan membuka browser dan menavigasi ke https://<yourfhir service>.azurehealthcareapis.com/metadata. Jika pernyataan kemampuan ditampilkan atau diunduh secara otomatis, penyebaran Anda berhasil.

Membersihkan sumber daya

Saat sumber daya tidak lagi diperlukan, jalankan kode berikut untuk menghapus grup sumber daya.

$resourceGroupName = “your resource group name”
Remove-AzResourceGroup -Name $resourceGroupName

Langkah berikutnya

Dalam panduan mulai cepat ini, Anda telah menyebarkan layanan FHIR dalam Azure Health Data Services menggunakan templat ARM. Untuk informasi selengkapnya tentang fitur yang didukung layanan FHIR, lihat.

Catatan

FHIR® adalah merek dagang terdaftar HL7 dan digunakan dengan izin HL7.