- microsoft account
- active subscription
- installed .Net Core 3.1 SDK
- IDE for launching application locally if preferred Visual Studio 2019
-
Go to Auth0 website. If you do not have an account, sign up. You can log in using your microsoft account also
-
Create a Machine To Machine application. Name it technicaldocuindexer.
-
Click on your newly created application and from the settings subpage copy:
-
Go back to settings subpage, scroll down to Allowed Callback URLs and paste there following values:
https://localhost:44378/callback, https://TechnicalDocuIndexerWeb.azurewebsites.net/callback
-
In Allowed Logout URLs paste following values:
https://localhost:44378, https://TechnicalDocuIndexerWeb.azurewebsites.net
-
Go to Rules subtab and Create new Rule.
-
In new rule paste following code and save it.
-
function (user, context, callback) { const assignedRoles = (context.authorization || {}).roles; const idTokenClaims = context.idToken || {};
idTokenClaims['https://schemas.quickstarts.com/roles'] = assignedRoles;
callback(null, user, context); }
-
-
In Users & Roles subtab, go to Roles:
- Create Role FileUploader and SearchReader
-
Go to Users and create 2 new users:
- searchreader@
- fileuploader@
-
After creating both users, Click on their details, go to subtab Roles and add:
- SearchReader for searchreader@ user
- FileUploader for fileuploader@ user
-
Go to APIs subtab on the left and select your technicaldocuindexer API.
-
In settings tab, make sure you have enabled RBAC Settings and Add Permissions in the Access Token.
- Log in to Azure portal and create a new resource group.
- Create Function App resource "TDICustomSkills" , where we will store our serverless functions (custom skills).
- Create an Azure Cognitive Search Resource and name it cogni-technical-docu-indexer01.
- In newly created resource, create a new index.
- Copy from newly created search service:
- From Keys section, Primary admin key
- Search Service name, which should be cogsearchtechnicaldocuindexer01
- Search index name azureblob-index
- Copy from Cognitive Services resource:
- From keys and endpoint copy KEY 1
- Go to Azure DevOps portal, log in using your Microsoft account and create a new project.
- Decide whether your code will be hosted in Github or Azure Repos - we assume the code will be in Azure Repos.
- Click on tab and create a new repository.
- In newly created repository cloned Azure Knowledge mining repository and push it to master branch.
- Next, go to Pipelines and create a new variable group tdi-base in your repository.
- Fill up variables:
- Auth0Settings.Audience - API Identifier
- Auth0Settings.ClientId
- Auth0Settings.ClientSecret
- Auth0Settings.Domain
- Resource.Group.Name
- Search.APIKey
- Search.IndexName
- Search.QueryKey
- Search.Service - search service name
- Save them.
- Go to Pipelines subtab in Azure Pipelines.
- Create a new pipeline, with code in Azure Repos Git. It should auto-select an existing azure-pipelines.yml file from your repo.
- Submit creation of new pipeline and run it.
- Pipeline should have created all necessary resources for the application to work.
- In your local repository, launch CustomFunctions solution.
- Right click on the project, and Publish the code to the cloud, to TDICustomSkills FunctionApp.
- Repeat the proces for BingFunction solution.
-
In your cogsearchtechnicaldocuindexer01 click on skillsets and create a new skillset.
-
In skill definition Templates, select Custom Web API Skill - Azure Functions
-
For Template recognizing function paste
"inputs": [ { "name": "extension", "source": "/document/metadata_storage_file_extension" }, { "name": "content", "source": "/document/content" } ], "outputs": [ { "name": "foundServices", "targetName": "foundServices" }
-
For word count paste:
"inputs": [ { "name": "extension", "source": "/document/metadata_storage_file_extension" }, { "name": "content", "source": "/document/content" } ], "outputs": [ { "name": "wordCount", "targetName": "wordCount" }, { "name": "timeToRead", "targetName": "timeToRead" } ]
- Save new skillset.
- Go to your resource group.
- Click on sttechnicaldocuindexer Storage Account.
- In Containers subtab, create a new container initial-load and paste there files you would like to be searched upon (pdf, json, markdown files, png).
- Go to your cogsearchtechnicaldocuindexer01 and create new Indexer in Indexer tab.
- Fill out neccesary parameters. Choose an existing connection for Storage Connection string and pinpoint initial-load container.
- Go to Indexes tab and create a new Index.
- After creating new Index, remember to click on it and set CORS allowed origin type to Custom and set the URL of the webapp.
Navigate to https://technicaldocuindexerweb.azurewebsites.net, login using searchreader user and test your app!