Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,4 @@ services:
path: ./Dockerfile
context: ./
pipeline:
provider: github
hooks:
postprovision:
posix:
shell: sh
interactive: true
continueOnError: false
run: |
echo "
CONFIGURATION__AZURECOSMOSDB__ENDPOINT=\"$CONFIGURATION__AZURECOSMOSDB__ENDPOINT\"
CONFIGURATION__AZURECOSMOSDB__DATABASENAME=\"$CONFIGURATION__AZURECOSMOSDB__DATABASENAME\"
CONFIGURATION__AZURECOSMOSDB__CONTAINERNAME=\"$CONFIGURATION__AZURECOSMOSDB__CONTAINERNAME\"
" > ./src/.env
windows:
shell: pwsh
interactive: true
continueOnError: false
run: |
echo "
CONFIGURATION__AZURECOSMOSDB__ENDPOINT=""$env:CONFIGURATION__AZURECOSMOSDB__ENDPOINT""
CONFIGURATION__AZURECOSMOSDB__DATABASENAME=""$env:CONFIGURATION__AZURECOSMOSDB__DATABASENAME""
CONFIGURATION__AZURECOSMOSDB__CONTAINERNAME=""$env:CONFIGURATION__AZURECOSMOSDB__CONTAINERNAME""
" > ./src/.env
provider: github
8 changes: 6 additions & 2 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,17 @@ module containerAppsApp 'br/public:avm/res/app/container-app:0.9.0' = {
}
containers: [
{
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
image: 'mcr.microsoft.com/dotnet/samples:aspnetapp-9.0'
name: 'web-front-end'
resources: {
cpu: '0.25'
memory: '.5Gi'
}
env: [
{
name: 'ASPNETCORE_HTTP_PORTS'
value: '3030'
}
{
name: 'CONFIGURATION__AZURECOSMOSDB__ENDPOINT'
secretRef: 'azure-cosmos-db-nosql-endpoint'
Expand All @@ -205,7 +209,7 @@ module containerAppsApp 'br/public:avm/res/app/container-app:0.9.0' = {
}
}

// Azure Cosmos DB for Table outputs
// Azure Cosmos DB for NoSQL outputs
output CONFIGURATION__AZURECOSMOSDB__ENDPOINT string = cosmosDbAccount.outputs.endpoint
output CONFIGURATION__AZURECOSMOSDB__DATABASENAME string = databaseName
output CONFIGURATION__AZURECOSMOSDB__CONTAINERNAME string = containerName
Expand Down
5 changes: 1 addition & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ products:
This is a simple web application to illustrate common basic usage of Azure Cosmos DB for NoSQL with the Azure SDK for Rust.

> [!IMPORTANT]
> Local development is the only supported loop in this template.
>
> Azure SDK for Rust does not have support for user-assigned managed identity in Azure yet.
>
> Cloud development is the only supported loop in this template.

## Prerequisites

Expand Down
5 changes: 3 additions & 2 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ edition = "2021"

[dependencies]
axum = "0.7.7"
azure_data_cosmos = "0.22.0"
azure_identity = "0.22.0"
azure_data_cosmos = "0.23.0"
azure_identity = "0.24.0"
dotenv = "0.15.0"
fs = "0.0.5"
futures = "0.3.31"
serde = { version = "1.0.215", features = ["derive"] }
serde_json = "1.0.132"
Expand Down
8 changes: 4 additions & 4 deletions src/app/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ where
// <create_client>
let credential = DefaultAzureCredential::new()?;

let client = CosmosClient::new(&endpoint, credential, None)?;
let client = CosmosClient::new(&endpoint, credential.clone(), None)?;
// </create_client>

callback("Client created".to_string());
Expand Down Expand Up @@ -84,9 +84,9 @@ where

callback("Run query:".to_string());

while let Some(page_response) = pager.next().await {
let page = page_response?.into_body().await?;
for item in page.items {
while let Some(page) = pager.next().await {
let items: Vec<Item> = page?.into_items();
for item in items {
callback(serde_json::to_string_pretty(&item).unwrap());
}
}
Expand Down