From b8a5ce7f6eab27b875d3bb8cd93e9ff4db7bf95d Mon Sep 17 00:00:00 2001 From: Richin Jain Date: Fri, 3 Jun 2022 13:24:17 -0700 Subject: [PATCH 1/7] Adding EventHub creation to the deployment script --- .../azure_resource_provision.json | 177 +++++++++++++----- 1 file changed, 125 insertions(+), 52 deletions(-) diff --git a/docs/how-to-guides/azure_resource_provision.json b/docs/how-to-guides/azure_resource_provision.json index 78bd5baee..185e30299 100644 --- a/docs/how-to-guides/azure_resource_provision.json +++ b/docs/how-to-guides/azure_resource_provision.json @@ -2,47 +2,66 @@ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - - "resourcePrefix": { - "type": "string", + "minLength": 3, + "maxLength": 15, + "type": "String", "metadata": { "description": "Resource prefix for all the resource provisioned. This should be an alphanumeric string." - }, - "minLength": 3, - "maxLength": 15 + } }, "principalId": { - "type": "string", + "type": "String", "metadata": { "description": "Specifies the principal ID assigned to the role. You can find it by logging into 'https://shell.azure.com/bash' and run 'az ad signed-in-user show --query objectId -o tsv'" } }, "allowAllConnections": { - "type": "string", - "allowedValues": [ "true", "false" ], "defaultValue": "true", + "allowedValues": [ + "true", + "false" + ], + "type": "String", "metadata": { "description": "Specifies whether to allow client IPs to connect to Synapse" } }, "provisionPurview": { - "type": "string", - "allowedValues": [ "true", "false" ], "defaultValue": "true", + "allowedValues": [ + "true", + "false" + ], + "type": "String", "metadata": { "description": "Whether or not put purview in the provision script" } + }, + "provisionEventHub": { + "defaultValue": "true", + "allowedValues": [ + "true", + "false" + ], + "type": "String", + "metadata": { + "description": "Whether or not to deploy eventhub provision script" + } } }, - "functions": [], "variables": { "location": "[resourceGroup().location]", "tenantId": "[subscription().tenantId]", "redisCacheName": "[concat(parameters('resourcePrefix'),'redis' )]", "keyVaultName": "[concat(parameters('resourcePrefix'),'kv')]", + "eventhubNameSpaceName": "[concat(parameters('resourcePrefix'),'ehnamespace')]", + "eventhubName": "[concat(parameters('resourcePrefix'),'eh')]", + "eventhubSku": "Standard", + "eventhubSkuCapacity": 1, "keyVault": "[resourceId('Microsoft.KeyVault/vaults', variables('keyVaultName'))]", "redisCache": "[resourceId('Microsoft.Cache/redis', variables('redisCacheName'))]", + "eventhubNameSpace": "[resourceId('Microsoft.EventHub/namespaces/', variables('eventhubNameSpaceName'))]", "sparkPoolName": "spark31", "workspaceName": "[toLower(concat(parameters('resourcePrefix'),'syws'))]", "dlsName": "[toLower(concat(parameters('resourcePrefix'), 'dls'))]", @@ -54,6 +73,7 @@ "roleAssignmentNameForBlobContributor": "[guid(parameters('principalId'), variables('roleDefinitionIdForBlobContributor'), resourceGroup().id)]", "roleAssignmentNameForKeyVaultSecretsUser": "[guid(parameters('principalId'), variables('roleDefinitionIdForKeyVaultSecretsUser'), resourceGroup().id)]" }, + "functions": [], "resources": [ { "type": "Microsoft.KeyVault/vaults", @@ -73,24 +93,22 @@ "resources": [ { "type": "Microsoft.KeyVault/vaults/secrets", - "name": "[concat(variables('keyVaultName'), '/FEATHR-PREFIX')]", "apiVersion": "2021-10-01", + "name": "[concat(variables('keyVaultName'), '/FEATHR-PREFIX')]", "location": "[resourceGroup().location]", - "properties": { - "value": "[parameters('resourcePrefix')]" - }, "dependsOn": [ "[variables('keyVault')]" - ] + ], + "properties": { + "value": "[parameters('resourcePrefix')]" + } } - ] }, - { "type": "Microsoft.Cache/redis", - "name": "[variables('redisCacheName')]", "apiVersion": "2021-06-01", + "name": "[variables('redisCacheName')]", "location": "[resourceGroup().location]", "tags": { "displayName": "Feathr Online Store" @@ -106,23 +124,29 @@ "resources": [ { "type": "Microsoft.KeyVault/vaults/secrets", - "name": "[concat(variables('keyVaultName'), '/FEATHR-ONLINE-STORE-CONN')]", "apiVersion": "2021-10-01", + "name": "[concat(variables('keyVaultName'), '/FEATHR-ONLINE-STORE-CONN')]", "location": "[resourceGroup().location]", + "dependsOn": [ + "[variables('keyVault')]", + "[variables('redisCache')]" + ], "properties": { "value": "[concat(variables('redisCacheName'),'.redis.cache.windows.net:6380,password=', listKeys(concat('Microsoft.Cache/redis/', variables('redisCacheName')), '2021-06-01').primaryKey, ',ssl=True')]" - }, - "dependsOn": [ "[variables('keyVault')]", "[variables('redisCache')]" ] + } }, { "type": "Microsoft.KeyVault/vaults/secrets", - "name": "[concat(variables('keyVaultName'), '/REDIS-PASSWORD')]", "apiVersion": "2021-10-01", + "name": "[concat(variables('keyVaultName'), '/REDIS-PASSWORD')]", "location": "[resourceGroup().location]", + "dependsOn": [ + "[variables('keyVault')]", + "[variables('redisCache')]" + ], "properties": { "value": "[listKeys(concat('Microsoft.Cache/redis/', variables('redisCacheName')), '2021-06-01').primaryKey]" - }, - "dependsOn": [ "[variables('keyVault')]", "[variables('redisCache')]" ] + } } ] }, @@ -143,21 +167,22 @@ }, "resources": [ { - "name": "[concat('default/', variables('dlsFsName'))]", "type": "blobServices/containers", "apiVersion": "2021-08-01", - "dependsOn": [ "[variables('dlsName')]" ], + "name": "[concat('default/', variables('dlsFsName'))]", + "dependsOn": [ + "[variables('dlsName')]" + ], "properties": { "publicAccess": "None" } } ] }, - { + "condition": "[equals(parameters('provisionPurview'),'true')]", "type": "Microsoft.Purview/accounts", "apiVersion": "2021-07-01", - "condition": "[equals(parameters('provisionPurview'),'true')]", "name": "[variables('purviewName')]", "location": "[variables('location')]", "sku": { @@ -172,16 +197,61 @@ "publicNetworkAccess": "Enabled" } }, - + { + "condition": "[equals(parameters('provisionEventHub'),'true')]", + "type": "Microsoft.EventHub/namespaces", + "apiVersion": "2018-01-01-preview", + "name": "[variables('eventhubNameSpaceName')]", + "location": "[variables('location')]", + "sku": { + "name": "[variables('eventhubSku')]", + "tier": "[variables('eventhubSku')]", + "capacity": "[variables('eventhubSkuCapacity')]" + }, + "properties": {}, + "resources": [ + { + "condition": "[equals(parameters('provisionEventHub'),'true')]", + "type": "eventhubs", + "apiVersion": "2017-04-01", + "name": "[variables('eventhubName')]", + "dependsOn": [ + "[variables('eventhubNameSpace')]" + ], + "properties": {} + }, + { + "condition": "[equals(parameters('provisionEventHub'),'true')]", + "type": "Microsoft.KeyVault/vaults/secrets", + "apiVersion": "2021-10-01", + "name": "[concat(variables('keyVaultName'), '/EVENTHUB-POLICY-KEY')]", + "condition": "[equals(parameters('provisionEventHub'),'true')]", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[variables('keyVault')]", + "[variables('eventhubNameSpace')]" + ], + "properties": { + "value": "[if(equals(parameters('provisionEventHub'),'true'),listKeys(resourceId('Microsoft.EventHub/namespaces/AuthorizationRules',variables('eventhubNameSpaceName'),'RootManageSharedAccessKey'),'2015-08-01').primaryConnectionString)]", + "dependsOn": [ + "[variables('eventhubNameSpace')]" + ] + } + } + ] + }, { "type": "Microsoft.Synapse/workspaces", "apiVersion": "2021-06-01", "name": "[variables('workspaceName')]", "location": "[variables('location')]", + "dependsOn": [ + "[variables('dlsName')]", + "[variables('dlsFsName')]" + ], "identity": { "type": "SystemAssigned" }, - "dependsOn": [ "[variables('dlsName')]", "[variables('dlsFsName')]" ], "properties": { "defaultDataLakeStorage": { "accountUrl": "[reference(variables('dlsName')).primaryEndpoints.dfs]", @@ -191,23 +261,27 @@ }, "resources": [ { - "condition": "[equals(parameters('allowAllConnections'),'true')]", "type": "firewallrules", "apiVersion": "2021-06-01", "name": "allowAll", "location": "[variables('location')]", - "dependsOn": [ "[variables('workspaceName')]" ], + "dependsOn": [ + "[variables('workspaceName')]" + ], "properties": { "startIpAddress": "0.0.0.0", "endIpAddress": "255.255.255.255" - } + }, + "condition": "[equals(parameters('allowAllConnections'),'true')]" }, { "type": "firewallrules", "apiVersion": "2021-06-01", "name": "AllowAllWindowsAzureIps", "location": "[variables('location')]", - "dependsOn": [ "[variables('workspaceName')]" ], + "dependsOn": [ + "[variables('workspaceName')]" + ], "properties": { "startIpAddress": "0.0.0.0", "endIpAddress": "0.0.0.0" @@ -218,7 +292,9 @@ "apiVersion": "2021-06-01", "name": "default", "location": "[variables('location')]", - "dependsOn": [ "[variables('workspaceName')]" ], + "dependsOn": [ + "[variables('workspaceName')]" + ], "properties": { "grantSqlControlToManagedIdentity": { "desiredState": "Enabled" @@ -232,7 +308,9 @@ "apiVersion": "2021-06-01", "name": "[concat(variables('workspaceName'), '/', variables('sparkPoolName'))]", "location": "[variables('location')]", - "dependsOn": [ "[variables('workspaceName')]" ], + "dependsOn": [ + "[variables('workspaceName')]" + ], "properties": { "autoPause": { "delayInMinutes": 30, @@ -249,37 +327,32 @@ "nodeSize": "Medium" } }, - - - { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2020-10-01-preview", "name": "[variables('roleAssignmentNameForBlobContributor')]", + "dependsOn": [ + "[variables('dlsAccount')]" + ], "properties": { "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('roleDefinitionIdForBlobContributor'))]", "principalId": "[parameters('principalId')]", "scope": "[resourceGroup().id]" - }, - "dependsOn": [ - "[variables('dlsAccount')]" - ] + } }, { "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2020-10-01-preview", "name": "[variables('roleAssignmentNameForKeyVaultSecretsUser')]", + "dependsOn": [ + "[variables('keyVault')]" + ], "properties": { "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('roleDefinitionIdForKeyVaultSecretsUser'))]", "principalId": "[parameters('principalId')]", "scope": "[resourceGroup().id]" - }, - "dependsOn": [ - "[variables('keyVault')]" - ] + } } - - ], "outputs": {} -} +} \ No newline at end of file From 8d162f0830fcb8d4b0698624a087ae64416a3041 Mon Sep 17 00:00:00 2001 From: Richin Jain Date: Fri, 3 Jun 2022 14:41:17 -0700 Subject: [PATCH 2/7] Upgrading API versions and fixing the if clause of KV property creation for EH --- docs/how-to-guides/azure_resource_provision.json | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/how-to-guides/azure_resource_provision.json b/docs/how-to-guides/azure_resource_provision.json index 185e30299..33117f60d 100644 --- a/docs/how-to-guides/azure_resource_provision.json +++ b/docs/how-to-guides/azure_resource_provision.json @@ -55,7 +55,7 @@ "tenantId": "[subscription().tenantId]", "redisCacheName": "[concat(parameters('resourcePrefix'),'redis' )]", "keyVaultName": "[concat(parameters('resourcePrefix'),'kv')]", - "eventhubNameSpaceName": "[concat(parameters('resourcePrefix'),'ehnamespace')]", + "eventhubNameSpaceName": "[concat(parameters('resourcePrefix'),'ehns')]", "eventhubName": "[concat(parameters('resourcePrefix'),'eh')]", "eventhubSku": "Standard", "eventhubSkuCapacity": 1, @@ -200,7 +200,7 @@ { "condition": "[equals(parameters('provisionEventHub'),'true')]", "type": "Microsoft.EventHub/namespaces", - "apiVersion": "2018-01-01-preview", + "apiVersion": "2021-11-01", "name": "[variables('eventhubNameSpaceName')]", "location": "[variables('location')]", "sku": { @@ -213,7 +213,7 @@ { "condition": "[equals(parameters('provisionEventHub'),'true')]", "type": "eventhubs", - "apiVersion": "2017-04-01", + "apiVersion": "2021-11-01", "name": "[variables('eventhubName')]", "dependsOn": [ "[variables('eventhubNameSpace')]" @@ -232,10 +232,7 @@ "[variables('eventhubNameSpace')]" ], "properties": { - "value": "[if(equals(parameters('provisionEventHub'),'true'),listKeys(resourceId('Microsoft.EventHub/namespaces/AuthorizationRules',variables('eventhubNameSpaceName'),'RootManageSharedAccessKey'),'2015-08-01').primaryConnectionString)]", - "dependsOn": [ - "[variables('eventhubNameSpace')]" - ] + "value": "[if(equals(parameters('provisionEventHub'),'true'),listKeys(resourceId('Microsoft.EventHub/namespaces/AuthorizationRules',variables('eventhubNameSpaceName'),'RootManageSharedAccessKey'),'2021-11-01').primaryConnectionString,'null' )]" } } ] From a4a88b4b82eab7ed963e014353f2a6480c350c2e Mon Sep 17 00:00:00 2001 From: Richin Jain Date: Mon, 13 Jun 2022 15:36:17 -0700 Subject: [PATCH 3/7] Adding template to create app service plan and webapp. The web app pulls a public image from dockerhub. Also fixing a bug to fetch principal id --- .../azure_resource_provision.json | 52 +++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/docs/how-to-guides/azure_resource_provision.json b/docs/how-to-guides/azure_resource_provision.json index 33117f60d..381de61a5 100644 --- a/docs/how-to-guides/azure_resource_provision.json +++ b/docs/how-to-guides/azure_resource_provision.json @@ -13,7 +13,7 @@ "principalId": { "type": "String", "metadata": { - "description": "Specifies the principal ID assigned to the role. You can find it by logging into 'https://shell.azure.com/bash' and run 'az ad signed-in-user show --query objectId -o tsv'" + "description": "Specifies the principal ID assigned to the role. You can find it by logging into 'https://shell.azure.com/bash' and run 'az ad signed-in-user show --query id -o tsv'" } }, "allowAllConnections": { @@ -71,7 +71,11 @@ "roleDefinitionIdForBlobContributor": "ba92f5b4-2d11-453d-a403-e96b0029c9fe", "roleDefinitionIdForKeyVaultSecretsUser": "4633458b-17de-408a-b874-0445c86b69e6", "roleAssignmentNameForBlobContributor": "[guid(parameters('principalId'), variables('roleDefinitionIdForBlobContributor'), resourceGroup().id)]", - "roleAssignmentNameForKeyVaultSecretsUser": "[guid(parameters('principalId'), variables('roleDefinitionIdForKeyVaultSecretsUser'), resourceGroup().id)]" + "roleAssignmentNameForKeyVaultSecretsUser": "[guid(parameters('principalId'), variables('roleDefinitionIdForKeyVaultSecretsUser'), resourceGroup().id)]", + "webAppName": "[concat(parameters('resourcePrefix'),'webapp' )]", + "webAppPlanName": "[concat(parameters('resourcePrefix'),'appplan' )]", + "webAppPlanSku": "P1v2", + "webAppAPIVersion": "2021-03-01" }, "functions": [], "resources": [ @@ -198,7 +202,7 @@ } }, { - "condition": "[equals(parameters('provisionEventHub'),'true')]", + "condition": "[equals(parameters('provisionEventHub'),'true')]", "type": "Microsoft.EventHub/namespaces", "apiVersion": "2021-11-01", "name": "[variables('eventhubNameSpaceName')]", @@ -349,6 +353,48 @@ "principalId": "[parameters('principalId')]", "scope": "[resourceGroup().id]" } + }, + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "[variables('webAppAPIVersion')]", + "name": "[variables('webAppPlanName')]", + "location": "[variables('location')]", + "sku": { + "name": "[variables('webAppPlanSku')]" + }, + "kind": "linux", + "properties": { + "reserved": true + } + }, + { + "type": "Microsoft.Web/sites", + "apiVersion": "[variables('webAppAPIVersion')]", + "name": "[variables('webAppName')]", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms', variables('webAppPlanName'))]" + ], + "kind": "app,linux,container", + "identity": { + "type": "systemAssigned" + }, + "properties": { + "name": "[variables('webAppName')]", + "httpsOnly": "true", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('webAppPlanName'))]", + "siteConfig": { + "linuxFxVersion": "DOCKER|dockercloud/hello-world", + "alwaysOn": true, + "ftpsState": "Disabled", + "appSettings": [ + { + "name": "DOCKER_REGISTRY_SERVER_URL", + "value": "https://index.docker.io/v1" + } + ] + } + } } ], "outputs": {} From eeb419562b8d8acda96d8db899717f4f77c99977 Mon Sep 17 00:00:00 2001 From: Richin Jain Date: Mon, 20 Jun 2022 16:49:59 -0700 Subject: [PATCH 4/7] Adding instructions to create AAD app, and parameters to consume it, and appsettings to pass it --- docs/how-to-guides/azure-deployment.md | 23 +++++++++++++-- .../azure_resource_provision.json | 28 +++++++++++++++++-- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/docs/how-to-guides/azure-deployment.md b/docs/how-to-guides/azure-deployment.md index 4df308cdb..cc825419a 100644 --- a/docs/how-to-guides/azure-deployment.md +++ b/docs/how-to-guides/azure-deployment.md @@ -15,10 +15,29 @@ Feathr has native cloud integration and getting started with Feathr is very stra 1. Get the principal ID of your account by running `az ad signed-in-user show --query id -o tsv` in the link below (Select "Bash" if you are asked to choose one), and write down that value (will be something like `b65ef2e0-42b8-44a7-9b55-abbccddeefff`) - [Launch Cloud Shell](https://shell.azure.com/bash) -2. Click the button below to deploy a minimal set of Feathr resources. This is not for production use as we choose a minimal set of resources, but treat it as a template that you can modify for further use. Note that you should have "Owner" access in your subscription to perform some of the actions. + +2. To enable authentication on the Feathr UI (which gets created as part of the deployment script) we need to create an Azure Active Directory (AAD) application. Currently it is not possible to create one through ARM template but you can easily create one by running the following CLI commands on the Cloud Shell + +```bash +# This is the prefix you want to name your resources with, make a note of it, you will need it during deployment. +export prefix="YOUR_RESOURCE_PREFIX" + +# Please don't change this name, a corresponding webapp with same name gets created in subsequent steps. +export sitename="{prefix}webapp" + +# Create Azure AD app +az ad app create --display-name $sitename --sign-in-audience AzureADMyOrg --web-home-page-url "https://$sitename.azurewebsites.net/api/updates" --web-redirect-uris "https://$sitename.azurewebsites.net" --enable-id-token-issuance true + +# Run following commands to get the Tenant Id and Client Id, please make a note of this you will need it during deployment +az account tenant list --query [0].tenantId -o tsv #TenantId + +az ad app list --display-name $sitename --query [0].appId -o tsv #ClientId + +``` + +3. Click the button below to deploy a minimal set of Feathr resources. This is not for production use as we choose a minimal set of resources, but treat it as a template that you can modify for further use. Note that you should have "Owner" access in your subscription to perform some of the actions. [![Deploy to Azure](https://aka.ms/deploytoazurebutton)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Flinkedin%2Ffeathr%2Fmain%2Fdocs%2Fhow-to-guides%2Fazure_resource_provision.json) diff --git a/docs/how-to-guides/azure_resource_provision.json b/docs/how-to-guides/azure_resource_provision.json index da676dda5..378608cd7 100644 --- a/docs/how-to-guides/azure_resource_provision.json +++ b/docs/how-to-guides/azure_resource_provision.json @@ -46,7 +46,19 @@ "metadata": { "description": "The flavor of the registry backend to deploy, current supported types are Azure Purview and Azure SQL" } - } + }, + "aadClientId": { + "type": "String", + "metadata": { + "description": "Client Id of the Azure Active Directory (AAD) app provisioned for UI app authentication in the prior step." + } + }, + "aadTenantId": { + "type": "String", + "metadata": { + "description": "Tenant Id of the Azure Active Directory (AAD) app provisioned for UI app authentication in the prior step." + } + } }, "variables": { "location": "[resourceGroup().location]", @@ -317,7 +329,19 @@ { "name": "DOCKER_REGISTRY_SERVER_URL", "value": "https://index.docker.io/v1" - } + }, + { + "name": "AZURE_CLIENT_ID", + "value": "[parameters('aadClientId')]" + }, + { + "name": "AZURE_TENANT_ID", + "value": "[parameters('aadTenantId')]" + }, + { + "name": "CONNECTION_STR", + "value": "TODO_ONCE_SQL_PR_IS_MERGED" + } ] } } From ecee91d28742143f205ba53f7f9a9709330fc972 Mon Sep 17 00:00:00 2001 From: Richin Jain Date: Tue, 21 Jun 2022 15:23:01 -0700 Subject: [PATCH 5/7] Adding further steps for AAD to create it of type SPA - SIngle Platform Application --- docs/how-to-guides/azure-deployment.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/how-to-guides/azure-deployment.md b/docs/how-to-guides/azure-deployment.md index cc825419a..635dfb227 100644 --- a/docs/how-to-guides/azure-deployment.md +++ b/docs/how-to-guides/azure-deployment.md @@ -18,23 +18,29 @@ Feathr has native cloud integration and getting started with Feathr is very stra [Launch Cloud Shell](https://shell.azure.com/bash) -2. To enable authentication on the Feathr UI (which gets created as part of the deployment script) we need to create an Azure Active Directory (AAD) application. Currently it is not possible to create one through ARM template but you can easily create one by running the following CLI commands on the Cloud Shell +2. To enable authentication on the Feathr UI (which gets created as part of the deployment script) we need to create an Azure Active Directory (AAD) application. Currently it is not possible to create one through ARM template but you can easily create one by running the following CLI commands in the [Cloud Shell](https://shell.azure.com/bash) ```bash # This is the prefix you want to name your resources with, make a note of it, you will need it during deployment. -export prefix="YOUR_RESOURCE_PREFIX" +prefix="YOUR_RESOURCE_PREFIX" # Please don't change this name, a corresponding webapp with same name gets created in subsequent steps. -export sitename="{prefix}webapp" +sitename="${prefix}webapp" -# Create Azure AD app -az ad app create --display-name $sitename --sign-in-audience AzureADMyOrg --web-home-page-url "https://$sitename.azurewebsites.net/api/updates" --web-redirect-uris "https://$sitename.azurewebsites.net" --enable-id-token-issuance true +# This will create the Azure AD application, note that we need to create an AAD app of platform type Single Page Application(SPA). By default passing the redirect-uris with create command creates an app of type web. +az ad app create --display-name $sitename --sign-in-audience AzureADMyOrg --web-home-page-url "https://$sitename.azurewebsites.net" --enable-id-token-issuance true -# Run following commands to get the Tenant Id and Client Id, please make a note of this you will need it during deployment -az account tenant list --query [0].tenantId -o tsv #TenantId +#Fetch the ClientId, TenantId and ObjectId for the created app +aad_clientId=$(az ad app list --display-name $sitename --query [].appId -o tsv) +aad_objectId=$(az ad app list --display-name $sitename --query [].id -o tsv) +aad_tenantId=$(az account tenant list --query [].tenantId -o tsv) -az ad app list --display-name $sitename --query [0].appId -o tsv #ClientId +# Updating the SPA app created above, currently there is no CLI support to add redirectUris to a SPA, so we have to patch manually via az rest +az rest --method PATCH --uri "https://graph.microsoft.com/v1.0/applications/$aad_objectId" --headers "Content-Type=application/json" --body "{spa:{redirectUris:['https://$sitename.azurewebsites.net/.auth/login/aad/callback']}}" +# Make a note of the ClientId and TenantId, you will need it during deployment. +echo "AAD_CLIENT_ID: $aad_clientId" +echo "AZURE_TENANT_ID: $aad_tenantId" ``` 3. Click the button below to deploy a minimal set of Feathr resources. This is not for production use as we choose a minimal set of resources, but treat it as a template that you can modify for further use. Note that you should have "Owner" access in your subscription to perform some of the actions. From a3c939e154a723ccf38a2e1b1487a9e7fa15c51d Mon Sep 17 00:00:00 2001 From: Blair Chen Date: Thu, 23 Jun 2022 00:16:10 +0800 Subject: [PATCH 6/7] Add API_BASE to web app settings --- docs/how-to-guides/azure_resource_provision.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/how-to-guides/azure_resource_provision.json b/docs/how-to-guides/azure_resource_provision.json index 378608cd7..852f3dda8 100644 --- a/docs/how-to-guides/azure_resource_provision.json +++ b/docs/how-to-guides/azure_resource_provision.json @@ -338,10 +338,14 @@ "name": "AZURE_TENANT_ID", "value": "[parameters('aadTenantId')]" }, + { + "name": "API_BASE", + "value": "api/v1" + } { "name": "CONNECTION_STR", "value": "TODO_ONCE_SQL_PR_IS_MERGED" - } + } ] } } From 29ead0f922c38de9b418ffa06c5f8158e9725dac Mon Sep 17 00:00:00 2001 From: Blair Chen Date: Thu, 23 Jun 2022 00:29:37 +0800 Subject: [PATCH 7/7] Fix json error --- docs/how-to-guides/azure_resource_provision.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to-guides/azure_resource_provision.json b/docs/how-to-guides/azure_resource_provision.json index 852f3dda8..44dff8b16 100644 --- a/docs/how-to-guides/azure_resource_provision.json +++ b/docs/how-to-guides/azure_resource_provision.json @@ -341,7 +341,7 @@ { "name": "API_BASE", "value": "api/v1" - } + }, { "name": "CONNECTION_STR", "value": "TODO_ONCE_SQL_PR_IS_MERGED"