Skip to content

Commit

Permalink
Personal/gkuber/smartonfhir (#147)
Browse files Browse the repository at this point in the history
* Script to setup the Application Registration instead of modifying JSON app manifest manually. This will support latest version of azure cli. Also updated the documents for prerequisite versions

* Specified prerequisite versions in document

---------

Co-authored-by: Ganesh Kuber <[email protected]>
  • Loading branch information
v-gkuber and Ganesh Kuber authored Oct 27, 2023
1 parent 3a5a52b commit de7d447
Show file tree
Hide file tree
Showing 4 changed files with 493 additions and 587 deletions.
25 changes: 11 additions & 14 deletions samples/smartonfhir/docs/ad-apps/fhir-resource-app-registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@ This application registration is used to customize the access token sent to the

## Deployment (manual)

1. Find your Primary Domain in Azure Active Directory
- Open Azure AD in the Azure Portal
- Note your `Primary Domain` in the Overview blade of Azure AD.
1. Create a FHIR Resource Application Registration
- Go to `App Registrations`
- Create a new application. It's easiest if this matches the name of your Azure Developer CLI environment.
- Click `Register` (ignore redirect URI).
1. Set the application URL
- Go to `Expose an API` blade.
- Set the application URL to https://<app-registration-name>.<Azure AD Primary Domain>.
- For example `https://my-app-1.mytenant.onmicrosoft.com`.
- Save the `Application URL` for later.
1. Add all the applicable FHIR Scopes.
- Go to the Manifest blade for your application.
- Change `acceptMappedClaims` from null to true.
- Copy the `appRoles` JSON element from [fhir-app-manifest.json](./fhir-app-manifest.json) to the `appRoles` JSON element in your application manifest.
- Copy the `oauth2Permissions` JSON element from [fhir-app-manifest.json](./fhir-app-manifest.json) to the `oauth2Permissions` JSON element in your application manifest.
1. Inform your Azure Developer CLI environment of this application with:
```
azd env set FhirAudience <FHIR Resource Application ID URI>
azd env set FhirResourceAppId <FHIR Resource App Id>
```
1. Run below command to configure a FHIR Resource Application Registration.
Windows:
```powershell
powershell ./scripts/Configure-FhirResourceAppRegistration.ps1
```
Mac/Linux
```bash
pwsh ./scripts/Configure-FhirResourceAppRegistration.ps1
```
1. Create a Microsoft Graph Directory Extension to hold the `fhirUser` information for users.
Windows:
Expand Down
10 changes: 5 additions & 5 deletions samples/smartonfhir/docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ In order to deploy this sample, you will need to install some Azure tools, ensur
Make sure you have the pre-requisites listed below
- **Installation:**
- [Git](https://git-scm.com/) to access the files in this repository.
- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) to run scripts that interact with Azure.
- [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd?tabs=baremetal%2Cwindows) to deploy the infrastructure and code for this sample.
- [Azure CLI Version 2.51.0 or Greater](https://learn.microsoft.com/cli/azure/install-azure-cli) to run scripts that interact with Azure.
- [Azure Developer CLI Version 1.2.0 or Greater](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd?tabs=baremetal%2Cwindows) to deploy the infrastructure and code for this sample.
- [Visual Studio](https://visualstudio.microsoft.com/), [Visual Studio Code](https://code.visualstudio.com/), or another development environment (for changing configuration debugging the sample code).
- [Node / NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for building the frontend application and installing the US Core FHIR Profile.
- [.NET SDK 6+](https://learn.microsoft.com/dotnet/core/sdk) installed (for building the sample).
- [PowerShell](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) installed for running scripts (works for Mac and Linux too!)
- [Node Version 18.17.1/ NPM Version 10.2.0](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) for building the frontend application and installing the US Core FHIR Profile.
- [.NET SDK Version 7.0.400](https://learn.microsoft.com/dotnet/core/sdk) installed (for building the sample).
- [PowerShell Version 5.1.22621.2428 or Greater](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) installed for running scripts (works for Mac and Linux too!).

- **Access:**
- Access to an Azure Subscription where you can create resources and add role assignments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ if (-not $FhirResourceAppId) {

$AppRoles = "$SCRIPT_PATH/manifest-json-contents/app-roles.json"
$OAuth2Permissions = "$SCRIPT_PATH/manifest-json-contents/oauth2-permissions.json"

$APP_NAME=$(az ad app show --id $FhirResourceAppId --query 'displayName' --output tsv)
$APP_NAME=$(az ad app show --id $FhirResourceAppId --query 'displayName' --output tsv)

$DOMAIN_INFO=$(az rest --method get --url 'https://graph.microsoft.com/v1.0/domains?$select=id')
$DOMAIN_JSON = $DOMAIN_INFO | ConvertFrom-Json
$PRIMARY_DOMAIN = $DOMAIN_JSON.value[0].id

azd env set FhirAudience "https://$APP_NAME.$PRIMARY_DOMAIN"

az ad app update --id $FhirResourceAppId --identifier-uris "https://$APP_NAME.$PRIMARY_DOMAIN" --set acceptMappedClaims=true appRoles=@$AppRoles oauth2Permissions=@$OAuth2Permissions
az ad app update --id $FhirResourceAppId --identifier-uris "https://$APP_NAME.$PRIMARY_DOMAIN" --set appRoles=@$AppRoles api=@$OAuth2Permissions

Write-Host "Done."
Loading

0 comments on commit de7d447

Please sign in to comment.