|
| 1 | +--- |
| 2 | +title: Deploy OSDU Admin UI on top of Azure Data Manager for Energy |
| 3 | +description: Learn how to deploy the OSDU Admin UI on top of your Azure Data Manager for Energy instance. |
| 4 | +ms.service: energy-data-services |
| 5 | +ms.topic: how-to |
| 6 | +ms.reviewer: shikhagarg |
| 7 | +ms.author: shikhagarg |
| 8 | +author: shikhagarg1 |
| 9 | +ms.date: 02/15/2024 |
| 10 | +--- |
| 11 | +# Deploy OSDU Admin UI on top of Azure Data Manager for Energy |
| 12 | + |
| 13 | +This guide shows you how to deploy the OSDU Admin UI on top of your Azure Data Manager for Energy instance. |
| 14 | + |
| 15 | +The OSDU Admin UI enables platform administrators to manage the Azure Data Manager for Energy data partition you connect it to. The management tasks include entitlements (user and group management), legal tags, schemas, reference data, and view objects and visualize those on a map. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | +- Install [Visual Studio Code with Dev Containers](https://code.visualstudio.com/docs/devcontainers/tutorial). It's possible to deploy the OSDU Admin UI from your local computer using either Linux or Windows WSL, we recommend using a Dev Container to eliminate potential conflicts of tooling versions, environments etc. |
| 19 | +- Provision an [Azure Data Manager for Energy instance](quickstart-create-microsoft-energy-data-services-instance.md). |
| 20 | +- Add the App Registration permissions to enable Admin UI to function properly: |
| 21 | + - [Application.Read.All](/graph/permissions-reference#applicationreadall) |
| 22 | + - [User.Read](/graph/permissions-reference#applicationreadall) |
| 23 | + - [User.Read.All](/graph/permissions-reference#userreadall) |
| 24 | + |
| 25 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/app-permission-1.png" alt-text="Screenshot that shows applications read all permission."::: |
| 26 | + |
| 27 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/app-permission-2.png" alt-text="Screenshot that shows user read all permission."::: |
| 28 | + |
| 29 | +## Environment setup |
| 30 | +1. Use the Dev Container in Visual Studio Code to deploy the OSDU Admin UI to eliminate conflicts from your local machine. |
| 31 | +2. Click on Open to clone the repository. |
| 32 | + |
| 33 | + [](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://community.opengroup.org/osdu/ui/admin-ui-group/admin-ui-totalenergies/admin-ui-totalenergies) |
| 34 | + |
| 35 | +3. Accept the cloning prompt. |
| 36 | + |
| 37 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/clone-the-repository.png" alt-text="Screenshot that shows cloning the repository."::: |
| 38 | + |
| 39 | +4. When prompted for a container configuration template, |
| 40 | + 1. Select [Ubuntu](https://github.com/devcontainers/templates/tree/main/src/ubuntu). |
| 41 | + 2. Accept the default version. |
| 42 | + 3. Add the [Azure CLI](https://github.com/devcontainers/features/tree/main/src/azure-cli) feature. |
| 43 | + |
| 44 | +  |
| 45 | + |
| 46 | +5. After a few minutes, the devcontainer is running. |
| 47 | + |
| 48 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/running-devcontainer.png" alt-text="Screenshot that shows running devcontainer."::: |
| 49 | + |
| 50 | +6. Open the terminal. |
| 51 | + |
| 52 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/open-terminal.png" alt-text="Screenshot that shows opening terminal."::: |
| 53 | + |
| 54 | +7. Install NVM, Node.js, npm, and Angular CLI by executing the command in the bash terminal. |
| 55 | + |
| 56 | + ```bash |
| 57 | + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \ |
| 58 | + export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" |
| 59 | + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ |
| 60 | + nvm install 14.17.3 && \ |
| 61 | + export NG_CLI_ANALYTICS=false && \ |
| 62 | + npm install -g @angular/ [email protected] && \ |
| 63 | + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash |
| 64 | + ``` |
| 65 | + |
| 66 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/install-screen.png" alt-text="Screenshot that shows installation."::: |
| 67 | + |
| 68 | +8. Log into Azure CLI by executing the command on the terminal. It takes you to the login screen. |
| 69 | + ```azurecli-interactive |
| 70 | + az login |
| 71 | + ``` |
| 72 | + |
| 73 | +9. It takes you to the login screen. Enter your credentials and upon success, you see a success message. |
| 74 | + |
| 75 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/login.png" alt-text="Screenshot that shows successful login."::: |
| 76 | + |
| 77 | + |
| 78 | +## Configure environment variables |
| 79 | +1. Fetch `client-id` as authAppId, `resource-group`, `subscription-id`, and `location`. |
| 80 | + |
| 81 | +  |
| 82 | + |
| 83 | +2. Fetch the value of `id` as the subscription ID by running the following command on the terminal. |
| 84 | + ```azurecli-interactive |
| 85 | + az account show |
| 86 | + ``` |
| 87 | + |
| 88 | +3. If the above ID isn't same as the `subcription-id` from the Azure Data Manager for Energy instance, you need to change subscription. |
| 89 | + ```azurecli-interactive |
| 90 | + az account set --subscription <subscription-id> |
| 91 | + ``` |
| 92 | +
|
| 93 | +4. Enter the required environment variables on the terminal. |
| 94 | + ```bash |
| 95 | + export CLIENT_ID="<client-id>" ## App Registration to be used by OSDU Admin UI, usually the client ID used to provision ADME |
| 96 | + export TENANT_ID="<tenant-id>" ## Tenant ID |
| 97 | + export ADME_URL="<adme-url>" ## Remove www or https from the text |
| 98 | + export DATA_PARTITION="<partition>" |
| 99 | + export WEBSITE_NAME="<storage-name>" ## Unique name of the storage account or static web app that will be generated |
| 100 | + export RESOURCE_GROUP="<resource-group>" ## Name of resource group |
| 101 | + export LOCATION="<location>" ## Azure region to deploy to, i.e. "westeurope" |
| 102 | + ``` |
| 103 | +
|
| 104 | +## Deploy storage account |
| 105 | +1. Create resource group. Skip this step if the resource group exists already. |
| 106 | + ```azurecli-interactive |
| 107 | + az group create \ |
| 108 | + --name $RESOURCE_GROUP \ |
| 109 | + --location $LOCATION |
| 110 | + ``` |
| 111 | + |
| 112 | +1. Create storage account. |
| 113 | + ```azurecli-interactive |
| 114 | + az storage account create \ |
| 115 | + --resource-group $RESOURCE_GROUP \ |
| 116 | + --location $LOCATION \ |
| 117 | + --name $WEBSITE_NAME \ |
| 118 | + --sku Standard_LRS \ |
| 119 | + --public-network-access Enabled \ |
| 120 | + --allow-blob-public-access true |
| 121 | + ``` |
| 122 | +
|
| 123 | +1. Configure the static website. |
| 124 | + ```azurecli-interactive |
| 125 | + az storage blob service-properties update \ |
| 126 | + --account-name $WEBSITE_NAME \ |
| 127 | + --static-website \ |
| 128 | + --404-document index.html \ |
| 129 | + --index-document index.html |
| 130 | + ``` |
| 131 | +
|
| 132 | +1. Fetch the redirect URI. |
| 133 | + ```azurecli-interactive |
| 134 | + export REDIRECT_URI=$(az storage account show --resource-group $RESOURCE_GROUP --name $WEBSITE_NAME --query "primaryEndpoints.web") && \ |
| 135 | + echo "Redirect URL: $REDIRECT_URI" |
| 136 | + ``` |
| 137 | +
|
| 138 | +1. Get the App Registration's Single-page Application (SPA) section. |
| 139 | + ```azurecli-interactive |
| 140 | + echo "https://ms.portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/~/Authentication/appId/$CLIENT_ID/isMSAApp~/false" |
| 141 | + ``` |
| 142 | + |
| 143 | +1. Open the link you got from the above result in the browser and add the `REDIRECT_URI`. |
| 144 | + |
| 145 | +  |
| 146 | + |
| 147 | +## Build and deploy the web app |
| 148 | + |
| 149 | +1. Navigate to the `OSDUApp` folder. |
| 150 | + ```bash |
| 151 | + cd OSDUApp/ |
| 152 | + ``` |
| 153 | +2. Install the dependencies. |
| 154 | + ```nodejs |
| 155 | + npm install |
| 156 | + ``` |
| 157 | +3. Modify the parameters in the config file located at `/src/config/config.json`. |
| 158 | + ```json |
| 159 | + { |
| 160 | + "mapboxKey": "key", // This is optional for the access token from Mapbox.com and used to visualize data on the map feature. |
| 161 | + ... |
| 162 | + "data_partition": "<adme_data_partition>", // ADME Data Partition ID (i.e. opendes) |
| 163 | + "idp": { |
| 164 | + ... |
| 165 | + "tenant_id": "<tenant_id>", // Entra ID tenant ID |
| 166 | + "client_id": "<client_id>", // App Registration ID to use for the admin UI, usually the same as the ADME App Registration ID, i.e. "6ee7e0d6-0641-4b29-a283-541c5d00655a" |
| 167 | + "redirect_uri": "<https://storageaccount.zXX.web.core.windows.net/>", // This is the website URL ($REDIRECT_URI) |
| 168 | + "scope": "<client_id>/.default" // Scope of the ADME instance, i.e. "6ee7e0d6-0641-4b29-a283-541c5d00655a/.default" |
| 169 | + }, |
| 170 | + "api_endpoints": { // Just replace contoso.energy.azure.com with your ADME_URL after removing https or wwww in all the API endpoints below. |
| 171 | + "entitlement_endpoint": "https://contoso.energy.azure.com/api/", |
| 172 | + "storage_endpoint": "https://contoso.energy.azure.com/api/", |
| 173 | + "search_endpoint": "https://contoso.energy.azure.com/api/", |
| 174 | + "legal_endpoint": "https://contoso.energy.azure.com/api/", |
| 175 | + "schema_endpoint": "https://contoso.energy.azure.com/api/", |
| 176 | + "osdu_connector_api_endpoint":"osdu_connector", // Optional. API endpoint of the OSDU Connector API* |
| 177 | + "file_endpoint": "https://contoso.energy.azure.com/api/", |
| 178 | + "graphAPI_endpoint": "https://graph.microsoft.com/v1.0/", |
| 179 | + "workflow_endpoint": "https://contoso.energy.azure.com/api/" |
| 180 | + } |
| 181 | + ... |
| 182 | + } |
| 183 | + ``` |
| 184 | + |
| 185 | + |
| 186 | + \* [OSDU Connector API](https://community.opengroup.org/osdu/ui/admin-ui-group/admin-ui-totalenergies/connector-api-totalenergies) is built as an interface between consumers and OSDU APIs wrapping some API chain calls and objects. Currently, it manages all operations and actions on project and scenario objects. |
| 187 | + |
| 188 | +4. If you aren't able to give app permissions in the Prerequisite step because of the subscription constraints, remove `User.ReadBasic.All` and `Application.Read.All` from the `src/config/environments/environment.ts`. Removing these permissions would disable the Admin UI from converting the OIDs of users and applications into the user names and application names respectively. |
| 189 | +
|
| 190 | + :::image type="content" source="media/how-to-deploy-osdu-admin-ui/graph-permission.png" alt-text="Screenshot that shows graph permissions."::: |
| 191 | + |
| 192 | +5. Build the web UI. |
| 193 | + ```bash |
| 194 | + ng build |
| 195 | + ``` |
| 196 | +
|
| 197 | +6. Upload the build to Storage Account. |
| 198 | + ```azurecli-interactive |
| 199 | + az storage blob upload-batch \ |
| 200 | + --account-name $WEBSITE_NAME \ |
| 201 | + --source ./dist/OSDUApp \ |
| 202 | + --destination '$web' \ |
| 203 | + --overwrite |
| 204 | + ``` |
| 205 | + |
| 206 | +7. Fetch the website URL. |
| 207 | + ```bash |
| 208 | + echo $REDIRECT_URI |
| 209 | + ``` |
| 210 | +
|
| 211 | +8. Open the Website URL in the browser and validate that it's working correctly and connected to the correct Azure Data Manager for Energy instance. |
| 212 | + |
| 213 | +## References |
| 214 | + |
| 215 | +For information about OSDU Admin UI, see [OSDU GitLab](https://community.opengroup.org/osdu/ui/admin-ui-group/admin-ui-totalenergies/admin-ui-totalenergies).<br> |
| 216 | +For other deployment methods (Terraform or Azure DevOps pipeline), see [OSDU Admin UI DevOps](https://community.opengroup.org/osdu/ui/admin-ui-group/admin-ui-totalenergies/admin-ui-totalenergies/-/tree/main/OSDUApp/devops/azure). |
0 commit comments