Skip to content

Commit

Permalink
Update template store docs (#563)
Browse files Browse the repository at this point in the history
* update template store integration guidance

* correct claim about default templates in the intro

* re-arrange info

* fix formatting of env var text

* nits

* fix capitalization

* change images to light mode to match others

* re-order photos
  • Loading branch information
ShaunDonn2 authored May 30, 2024
1 parent 575fd14 commit e98864b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
63 changes: 39 additions & 24 deletions docs/how-to-guides/enable-template-store-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ This how-to-guide shows you how to configure the template store for the FHIR con

The service currently supports integration with Azure Storage Accounts to pull custom templates hosted within the blob container.

If you are using the quickstart version of the [deployment options](deployment-options.md#default-settings) with default settings, your FHIR converter service will be automatically configured to pull templates from a newly created Storage Account.

Alternatively, to configure a different/pre-existing storage account, follow the steps in this document.
If you are using the quickstart version of the [deployment options](deployment-options.md#default-settings) with default settings, your FHIR converter service will be configured to use the provided default templates. To configure your service to pull custom templates from a new or pre-existing Storage Account, follow the steps in this document.

## Template store settings overview

Expand All @@ -24,20 +22,39 @@ The configurable template store settings are :

| Element | Description |
| -------------------------- | --- |
| StorageAccountConfiguration:ContainerUrl | The URL of the storage account blob container containing the Liquid templates. |
| StorageAccountConfiguration:ContainerUrl | The URL of the Storage Account blob container containing the Liquid templates. |

## Configure storage account details
## Configure Storage Account details

### Prerequisites

To configure your template store with your FHIR converter service, you need to have an Azure Storage Account created with a blob container. Refer [Create a Storage Account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-create?tabs=azure-portal) for instructions to create one.
To configure your template store with your FHIR converter service, you need to have an Azure Storage Account created with a blob container. See [Configure your FHIR converter service for template store integration](#configure-your-fhir-converter-service-for-template-store-integration) below for details on using one of the provided deployment options to create a Storage Account and blob container, and integrate them with your FHIR converter service. Alternatively, refer to [Create a Storage Account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-create?tabs=azure-portal) for instructions to create one manually.

The custom Liquid templates need to be uploaded to the storage account blob container that will be configured with the service.
The custom Liquid templates need to be uploaded to the Storage Account blob container that will be configured with the service.
For guidance on how to create custom Liquid templates, refer [Customize templates](customize-templates.md).

### Grant permissions to the storage account
### Configure your FHIR converter service for template store integration

There are two options for configuring your FHIR converter to pull templates from a given Storage Account:

1. Use one of the provided deployment options outlined in [Deployment Options](deployment-options.md) to either deploy or redeploy your FHIR converter service, providing values for the following parameters:

| Parameter | Description |
| --- | --- |
| templateStoreIntegrationEnabled | This must be set to true to enable use of custom templates. |
| templateStorageAccountName | Name of the Storage Account from which to pull the custom templates. This can be set to a custom name, or it can be left blank to use an automatically calculated value. If no Storage Account exists with the provided name, a new one will be provisioned.|
| templateStorageAccountContainerName | Name of the blob container from which to pull the custom templates. This can be set to a custom name, or it can be left blank to use the default value. If no blob container exists with the provided custom name, a new one will be provisioned.|

2. Alternatively, if you already have a deployed Storage Account and blob container, you can directly provide the configuration via environment variables in your Azure Container App running the FHIR converter service by editing the container:
* ```TemplateHosting__StorageAccountConfiguration__ContainerUrl```: the blob container URL hosting the custom templates.

In order for the service to be able to load the custom templates from the storage account, the Azure Container App running the service needs to be granted appropriate permissions to read from the storage account.
Refer [Configure environment variables](https://learn.microsoft.com/en-us/azure/container-apps/environment-variables?tabs=portal) for more information.

![Convert template store config](../images/convert-template-store-config.png)

### Grant permissions to the Storage Account

In order for the service to be able to load the custom templates from the Storage Account, the Azure Container App running the service needs to be granted appropriate permissions to read from the Storage Account.

1. Enable managed identity on your Azure Container App.
* Your container app can be granted either a system-assigned identity or a user-assigned identity.
Expand All @@ -46,27 +63,15 @@ In order for the service to be able to load the custom templates from the storag

![Convert identity](../images/convert-identity.png)

1. Assign the identity created above,[`Storage Blob Data Reader`](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/storage#storage-blob-data-reader) role priveleges on the storage account container being configured with the service.
2. Assign the identity created above,[`Storage Blob Data Reader`](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/storage#storage-blob-data-reader) role priveleges on the Storage Account container being configured with the service.

Refer [Assign an Azure role for access to blob data](https://learn.microsoft.com/en-us/azure/storage/blobs/assign-azure-role-data-access?tabs=portal) for more information.

![Convert template store permissions](../images/convert-template-store-permissions.png)

### Set the template store configuration of your FHIR converter service

1. If you have deployed the FHIR converter service to Azure, provide the configuration:
* Use the deployment option (**TODO** insert instructions)

* Alternatively, you can directly provide the configuration via environment variables in your Azure Container App running the FHIR converter service by editing the container:
1. **TemplateHosting__StorageAccountConfiguration__ContainerUrl** - the blob container URL hosting the custom templates.

Refer [Configure environment variables](https://learn.microsoft.com/en-us/azure/container-apps/environment-variables?tabs=portal) for more information.

![Convert template store config](../images/convert-template-store-config.png)

### Verify template store health check

To verify your FHIR converter service is set up correctly to pull the custom templates from the configured storage account, use the below health check endpoint:
To verify your FHIR converter service is set up correctly to pull the custom templates from the configured Storage Account, use the below health check endpoint:

**GET `https://<CONTAINER APP ENDPOINT URL>/health/check`**

Expand All @@ -79,13 +84,23 @@ Sample response body
{
"name": "TemplateStoreHealthCheck",
"status": "Healthy",
"description": "Sucessfully connected to blob template store.",
"description": "Successfully connected to blob template store.",
"data": {}
}
]
}
```

## Uploading Custom Templates to the Storage Account

Templates should be uploaded to the blob container as ```.liquid``` files. They can be stored in the root of the container, or organized into directories. The value passed in to the ```RootTemplateName``` field of the request body represents the path of the template file from the root of the blob container.

For example, if the user intends to reference a custom template called ```sampleCustomTemplate.liquid```, which is located within the ```customTemplates1``` directory inside the ```template``` blob container, as shown below, the ```RootTemplateName``` should have value ```customTemplates1/sampleCustomTemplate```.

![Blob Container](../images/convert-storagecontainer.png)

![Blob Container directory](../images/convert-storagecontainerdirectory.png)

## Summary

In this how-to-guide, you learned how to configure the template store settings for the FHIR converter service to be able to use custom Liquid templates for conversion.
Expand Down
Binary file added docs/images/convert-storagecontainer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/convert-storagecontainerdirectory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e98864b

Please sign in to comment.