Skip to content

oktadev/okta_dotnet_cosmosdb_example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Secure PII using Azure Cosmos DB

This repository shows you how to build a web application with ASP.NET Core with a Cosmos DB backend and secure any PII that you may have. Please read Secure PII In Azure Cosmos DB to see how it was created.

Prerequisites:

Getting Started

To pull this example, first create an empty github repo. Next run the following commands:

git clone https://github.com/nickolasfisher/Okta_Cosmos.git
cd Okta_Cosmos

Create an OIDC Application in Okta

Create a free developer account with the following command using the Okta CLI:

okta register

If you already have a developer account, use okta login to integrate it with the Okta CLI. Create a client application in Okta with the following command:

okta apps create

You will be prompted to select the following options:

  • Application name: Azure-Static-App
  • Type of Application: *Webz8
  • Callback: http://localhost:5001/authorization-code/callback
  • Post Logout Redirect URI: http://localhost:5001/signout/callback

The application configuration will be printed to a file called .okta.env.

Create an Azure CosmosDB account

Navigate to the Azure portal and select Create a resource. Search for Azure Cosmos DB and select the option. Follow the prompt and select Create on the Azure Cosmos DB marketing page.

Next, you will see a page asking which API best suits your workload. Find Core (SQL) - Recommended and press Create.

The Create Azure Cosmos DB Account - Core (SQL) page provides the details about your subscription and resource group. Make sure you select Apply under the Apply Free Tier Discount then press Review + create.

Update the values in your project

Create a copy of appsettings.json named appsettings.Development.json. Replace the settings in Okta with the values in .okta.env.

Replace the empty values in CosmosDb with those found in your Azure portal. To find your Cosmos values navigate to your Cosmos DB account page and open the Settings > Keys tab. Here you will find the URI, PRIMARY KEY, and other values you may need down the line.

You can now run your application locally.

Links

This example uses the following open source libraries from Okta:

Help

Please post any questions as comments on the blog post, or visit our Okta Developer Forums.

License

Apache 2.0, see LICENSE.

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 57.6%
  • HTML 34.0%
  • CSS 6.9%
  • JavaScript 1.5%