Simpelt duste-api
Gets a report from mongodb. If report have finishedTimestamp: null, returns status 202. If report have value in finishedTimestamp returns 200.
Creates a new report in mongodb, and returns reportId (ObjectId)
Returns list of users that matches the query (case-insensitive):
{
$or: [
{ displayName: regex },
{ samAccountName: regex },
{ userPrincipalName: regex }
]
}
- Install azure-function-core-tools
- Clone this repo
git clone <this repo>
- Install project
npm i
- Create local.settings.json
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
"AzureWebJobsStorage": "",
"MONGODB_CONNECTION_STRING": "mongodb+srv://{db-user}:{db-user-password}@{cluster-url}/?retryWrites=true&w=majority",
"MONGODB_USERS_COLLECTION": "{name of users collection}",
"MONGODB_REPORT_COLLECTION": "{name of reports collection}",
"MONGODB_DB_NAME": "{name of db}",
"DUST_USER_ROLE": "{name of role for regular access}",
"DUST_ADMIN_ROLE": "{name of role for admin access}"
},
"Host": {
"CORS": "*" // For cors in local development
}
}
- Start up the local environment
func start
(Through portal / AZ CLI / Terraform / Bicep)
- Azure function
- With entra Id authentication enabled through app registration
- Add the roles DUST_USER_ROLE and DUST_ADMIN_ROLE to the app registration
- Make sure the api user_impersonation is exposed from the app registration
- With entra Id authentication enabled through app registration
Through AZ CLI or Github actions / Azure pipelines or similar