Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 2.29 KB

tutorial-use-cosmos-db-to-store-anchors.md

File metadata and controls

46 lines (29 loc) · 2.29 KB
title description author manager services ms.author ms.date ms.topic ms.service
Tutorial: Share anchors with Azure Cosmos DB
In this tutorial, you learn how to share Azure Spatial Anchors identifiers across Android/iOS devices in Unity with a back-end service and Azure Cosmos DB.
pamistel
MehranAzimi-msft
azure-spatial-anchors
pamistel
11/20/2020
tutorial
azure-spatial-anchors

Tutorial: Sharing Azure Spatial Anchors across sessions and devices with an Azure Cosmos DB back end

This tutorial is a continuation of sharing Azure Spatial Anchors across sessions and devices. It will guide you through the process of adding a few more capabilities to make Azure Cosmos DB serve as the back-end storage while sharing Azure spatial anchors across sessions and devices.

GIF illustrating object persistence

It's worth noting that, though you'll be using Unity and Azure Cosmos DB in this tutorial, it's just to give you an example of how to share Spatial Anchors identifiers across devices. You can user other languages and back-end technologies to achieve the same goal.

Create a database account

Add an Azure Cosmos DB database to the resource group you created earlier.

[!INCLUDE cosmos-db-create-dbaccount-table]

Copy the Connection String because you'll need it.

Make minor changes to the SharingService files

In Solution Explorer, open SharingService\Startup.cs.

Locate #define INMEMORY_DEMO at the top of the file and comment that line out. Save the file.

In Solution Explorer, open SharingService\appsettings.json.

Locate the StorageConnectionString property, and set the value to be the same as the Connection String value that you copied in the create a database account step. Save the file.

You can publish the Sharing Service again and run the sample app.

Next steps

In this tutorial, you've used Azure Cosmos DB to share anchor identifiers across devices. To learn more about how to use Azure Spatial Anchors in a new Unity HoloLens app, continue to the next tutorial.

[!div class="nextstepaction"] Starting a new Unity HoloLens app