Skip to content

Commit eac8e9f

Browse files
Removing stored procedure references from cosmosDB docs (#3000)
Signed-off-by: Ryan Lettieri <[email protected]> Signed-off-by: Ryan Lettieri <[email protected]> Co-authored-by: Ryan Lettieri <[email protected]> Co-authored-by: Mark Fussell <[email protected]>
1 parent 05850e7 commit eac8e9f

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

daprdocs/content/en/reference/components-reference/supported-state-stores/setup-azure-cosmosdb.md

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -168,62 +168,6 @@ az cosmosdb sql role assignment create \
168168
--role-definition-id "$ROLE_ID"
169169
```
170170

171-
### Creating the stored procedures for Dapr
172-
173-
When using Cosmos DB as a state store for Dapr, we need to create two stored procedures in your collection. When you configure the state store using a "master key", Dapr creates those for you, automatically. However, when your state store authenticates with Cosmos DB using Azure AD, because of limitations in the platform we are not able to do it automatically.
174-
175-
If you are using Azure AD to authenticate your Cosmos DB state store and have not created the stored procedures (or if you are using an outdated version of them), your Dapr sidecar will fail to start and you will see an error similar to this in your logs:
176-
177-
```text
178-
Dapr requires stored procedures created in Cosmos DB before it can be used as state store. Those stored procedures are currently not existing or are using a different version than expected. When you authenticate using Azure AD we cannot automatically create them for you: please start this state store with a Cosmos DB master key just once so we can create the stored procedures for you; otherwise, you can check our docs to learn how to create them yourself: https://aka.ms/dapr/cosmosdb-aad
179-
```
180-
181-
To fix this issue, you have two options:
182-
183-
1. Configure your component to authenticate with the "master key" just once, to have Dapr automatically initialize the stored procedures for you. While you need to use a "master key" the first time you launch your application, you should be able to remove that and use Azure AD credentials (including Managed Identities) after.
184-
2. Alternatively, you can follow the steps below to create the stored procedures manually. These steps must be performed before you can start your application the first time.
185-
186-
To create the stored procedures manually, you can use the commands below.
187-
188-
First, download the code of the stored procedures for the version of Dapr that you're using. This will create two `.js` files in your working directory:
189-
190-
```sh
191-
# Set this to the version of Dapr that you're using
192-
DAPR_VERSION="release-{{% dapr-latest-version short="true" %}}"
193-
curl -LfO "https://raw.githubusercontent.com/dapr/components-contrib/${DAPR_VERSION}/state/azure/cosmosdb/storedprocedures/__daprver__.js"
194-
curl -LfO "https://raw.githubusercontent.com/dapr/components-contrib/${DAPR_VERSION}/state/azure/cosmosdb/storedprocedures/__dapr_v2__.js"
195-
```
196-
197-
> You won't need to update the code for the stored procedures every time you update Dapr. Although the code for the stored procedures doesn't change often, sometimes we may make updates to that: when that happens, if you're using Azure AD authentication your Dapr sidecar will fail to launch until you update the stored procedures, re-running the commands above.
198-
199-
Then, using the Azure CLI create the stored procedures in Cosmos DB, for your account, database, and collection (or container):
200-
201-
```sh
202-
# Name of the Resource Group that contains your Cosmos DB
203-
RESOURCE_GROUP="..."
204-
# Name of your Cosmos DB account
205-
ACCOUNT_NAME="..."
206-
# Name of your database in the Cosmos DB account
207-
DATABASE_NAME="..."
208-
# Name of the container (collection) in your database
209-
CONTAINER_NAME="..."
210-
211-
az cosmosdb sql stored-procedure create \
212-
--resource-group "$RESOURCE_GROUP" \
213-
--account-name "$ACCOUNT_NAME" \
214-
--database-name "$DATABASE_NAME" \
215-
--container-name "$CONTAINER_NAME" \
216-
--name "__daprver__" \
217-
--body @__daprver__.js
218-
az cosmosdb sql stored-procedure create \
219-
--resource-group "$RESOURCE_GROUP" \
220-
--account-name "$ACCOUNT_NAME" \
221-
--database-name "$DATABASE_NAME" \
222-
--container-name "$CONTAINER_NAME" \
223-
--name "__dapr_v2__" \
224-
--body @__dapr_v2__.js
225-
```
226-
227171
## Related links
228172

229173
- [Basic schema for a Dapr component]({{< ref component-schema >}})

0 commit comments

Comments
 (0)