Skip to content
Ole Martin Pettersen edited this page Mar 17, 2021 · 21 revisions

Logo

Wiki for Did


📖 Table of Contents

-----------------------------------------------------

➤ Table of Contents

* [➤ Creating your own app registration in the Azure Portal](#-creating-your-own-app-registration-in-the-azure-portal)
* [➤ Adding a new deployment slot](#-adding-a-new-deployment-slot)
* [➤ Roles and permissions](#-roles-and-permissions)
* [➤ Registering new subscription](#-registering-new-subscription)
		* [1. Go to the main storage account](#1-go-to-the-main-storage-account)
		* [2. Find table Subscriptions](#2-find-table-subscriptions)
		* [3. Add new entry](#3-add-new-entry)
		* [4. Add tables](#4-add-tables)
		* [5. Add Roles](#5-add-roles)
			* [Add User role](#add-user-role)
			* [Add Admin role](#add-admin-role)
		* [6. Add users](#6-add-users)
* [➤ Browsing Cosmos DB Mongo DB using Robo 3T](#-browsing-cosmos-db-mongo-db-using-robo-3t)

-----------------------------------------------------

➤ Creating your own app registration in the Azure Portal

  • Log on to portal.azure.com with your subscription
  • Navigate to Azure Active Directory -> App registrations
  • Create a New registration
    • With multi tenant support.
    • Note down the App id - this is your OAUTH_APP_ID env variable
  • Authentication
    • Set the redirect URIs
      • localhost:port/auth/callback for dev
      • yourwebsite.azurewebsites.net/auth/callback if you've created an enterprise app
    • Enable Implicit grant flow using both Access tokens and ID tokens
    • Ensure Supported account types are set to Multitenant
  • Certificates & secrets
    • Create a new Client secret and note it down - this is your OAUTH_APP_PASSWORD environment variables
  • API permissions - all Delegated
    • Calendars.Read
    • User.Read
    • offline_access
    • openid
  • Exposed APIs
    • Add a scope for Calendar.Read

-----------------------------------------------------

➤ Adding a new deployment slot

Some branches might contain breaking changes but should still be available for testing on www.

This is a quick guide showing you how to make a new deployment slot for your app in Azure.

  1. Go to your app in Azure (Did 365 App)
  2. Under Deployment find Deployment slots
  3. Click Add slot
  4. Pick a good name, e.g. the PR number (e.g. 212)
  5. Under Clone settings from: pick did365-dev
  6. When you're new slot is created go to Settings => Configuration => Application settings
  7. Change OAUTH_REDIRECT_URI to correspond with the URL of your slot. Note the value of OAUTH_APP_ID.
  8. Go to https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Overview/{OAUTH_APP_ID}/. Replace OAUTH_APP_ID with the ID from 7
  9. Go to Manage => Authentication
  10. Under Redirect URIs add the URL of your slot. Remember to append /auth/callback.
  11. Your new slot should be good to go!

-----------------------------------------------------

➤ Roles and permissions

Id Name Description
e18a7c45 accessCustomers Access Customers page
289a64ab accessProjects Access Projects page
2653c3aa accessAdmin Access Admin page
a031c42f accessReports Access Reports page
ef4032fb manageProjects Manage projects
c5439319 deleteProjects Delete projects
09909241 manageCustomers Manage customers
8b39db3d deleteCustomers Delete customers

-----------------------------------------------------

➤ Registering new subscription

1. Go to the main storage account

did365storage in resource group pzl-did.

2. Find table Subscriptions

3. Add new entry

image-20200824170155895
Property name Type Value
PartitionKey String Default
RowKey String Tenant ID
Name String Name of organisation
ConnectionString String Connection string for organization storage account

4. Add tables

Add the following tables to the organization storage account:

  • ConfirmedPeriods
  • Customers
  • Labels
  • Projects
  • Roles
  • TimeEntries
  • Users

5. Add Roles

Add User role
  • Go to table Roles
  • Add new entry
image-20200824170755510
Property name Type Value
PartitionKey String Default
RowKey String Random GUID
Name String User
Permissions String See Roles and permissions
Add Admin role
  • Go to table Roles

  • Add new entry

    image-20200824170755510
    Property name Type Value
    PartitionKey String Default
    RowKey String Random GUID
    Name String Admin
    Permissions String See Roles and permissions

6. Add users

  • Go to table Users

  • Add new entry

    image-20200824170540321
Property name Type Value
PartitionKey String Default
RowKey String User ID in Azure AD
FullName String Full name of the user
Role String User or Admin

-----------------------------------------------------

➤ Browsing Cosmos DB Mongo DB using Robo 3T

-----------------------------------------------------

➤ Installation

Download Robo 3T (freeware) from robomongo

-----------------------------------------------------

➤ Setup

Navigate to the Cosmos DB storage account in the Azure portal.

2021-03-04 15_52_26-

Set up the connection in Robo 3T. You will find Username and password under 2. from the image above

2021-03-04 15_47_22-

2021-03-04 15_48_00-

2021-03-04 15_48_18-

After adding the details click "Test", if everything is working you should see something like this

image-20210304160232635