We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @pulumi/azure.cosmosdb function in @pulumi/azure

To help you get started, we’ve selected a few @pulumi/azure examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / examples / azure-ts-serverless-url-shortener-global / index.ts View on Github external
import * as azure from "@pulumi/azure";
import * as pulumi from "@pulumi/pulumi";

const config = new pulumi.Config();
// Read a list of target locations from the config file:
// Expecting a comma-separated list, e.g., "westus,eastus,westeurope"
const locations = config.require("locations").split(",");
// The first location is considered primary
const primaryLocation = locations[0];

const resourceGroup = new azure.core.ResourceGroup("UrlShorterner", {
    location: primaryLocation,
});

// Cosmos DB with a single write region (primary location) and multiple read replicas
const account = new azure.cosmosdb.Account("UrlStore", {
    resourceGroupName: resourceGroup.name,
    location: primaryLocation,
    geoLocations: locations.map((location, failoverPriority) => ({ location, failoverPriority })),
    offerType: "Standard",
    consistencyPolicy: {
        consistencyLevel: "Session",
        maxIntervalInSeconds: 300,
        maxStalenessPrefix: 100000,
    },
});

// Define a database under the Cosmos DB Account
const database = new azure.cosmosdb.SqlDatabase("Database", {
    resourceGroupName: resourceGroup.name,
    accountName: account.name,
});
github pulumi / examples / azure-ts-serverless-url-shortener-global / index.ts View on Github external
offerType: "Standard",
    consistencyPolicy: {
        consistencyLevel: "Session",
        maxIntervalInSeconds: 300,
        maxStalenessPrefix: 100000,
    },
});

// Define a database under the Cosmos DB Account
const database = new azure.cosmosdb.SqlDatabase("Database", {
    resourceGroupName: resourceGroup.name,
    accountName: account.name,
});

// Define a SQL Collection under the Cosmos DB Database
const collection = new azure.cosmosdb.SqlContainer("Urls", {
    resourceGroupName: resourceGroup.name,
    accountName: account.name,
    databaseName: database.name,
});

// Traffic Manager as a global HTTP endpoint
const profile = new azure.trafficmanager.Profile("UrlShortEndpoint", {
    resourceGroupName: resourceGroup.name,
    trafficRoutingMethod: "Performance",
    dnsConfigs: [{
        // Subdomain must be globally unique, so we default it with the full resource group name
        relativeName: resourceGroup.name,
        ttl: 60,
    }],
    monitorConfigs: [{
        protocol: "HTTP",
github pulumi / kubernetes-guides / azure / 05-app-services / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as azure from "@pulumi/azure";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";

import { config } from "./config";
import * as mongoHelpers from "./mongoHelpers";

const name = pulumi.getProject();

// Define a separate resource group for app services.
const resourceGroup = new azure.core.ResourceGroup(name);

// Create a MongoDB-flavored instance of CosmosDB.
const cosmosdb = new azure.cosmosdb.Account("k8s-az-mongodb", {
    resourceGroupName: resourceGroup.name,
    kind: "MongoDB",
    consistencyPolicy: {
        consistencyLevel: "Session",
    },
    offerType: "Standard",
    geoLocations: [
        { location: resourceGroup.location, failoverPriority: 0 },
    ],
});

// A k8s provider instance of the cluster.
const provider = new k8s.Provider(`${name}-aks`, {
    kubeconfig: config.kubeconfig,
});
github pulumi / examples / azure-ts-cosmosapp-component / cosmosApp.ts View on Github external
constructor(name: string,
                args: CosmosAppArgs,
                opts: pulumi.ComponentResourceOptions = {}) {
        super("examples:azure:CosmosApp", name, args, opts);

        const resourceGroup = args.resourceGroup;
        const locations = pulumi.output(args.locations);
        const primaryLocation = locations[0];
        const parentOpts = { parent: this, ...opts };

        // Cosmos DB Account with multiple replicas
        const cosmosAccount = new azure.cosmosdb.Account(`cosmos-${name}`, {
            resourceGroupName: resourceGroup.name,
            location: primaryLocation,
            geoLocations: locations.apply(ls => ls.map((location, failoverPriority) => ({ location, failoverPriority }))),
            offerType: "Standard",
            consistencyPolicy: {
                consistencyLevel: "Session",
                maxIntervalInSeconds: 300,
                maxStalenessPrefix: 100000,
            },
            enableMultipleWriteLocations: args.enableMultiMaster,
        }, parentOpts);

        const database = new azure.cosmosdb.SqlDatabase(`db-${name}`, {
            resourceGroupName: resourceGroup.name,
            accountName: cosmosAccount.name,
            name: args.databaseName,
github pulumi / examples / azure-ts-aks-mean / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as azure from "@pulumi/azure";
import * as k8s from "@pulumi/kubernetes";
import * as config from "./config";
import * as mongoHelpers from "./mongoHelpers";

// Create an AKS cluster.
import { k8sCluster, k8sProvider } from "./cluster";

// Create a MongoDB-flavored instance of CosmosDB.
const cosmosdb = new azure.cosmosdb.Account("cosmosDb", {
    kind: "MongoDB",
    resourceGroupName: config.resourceGroup.name,
    consistencyPolicy: {
        consistencyLevel: "BoundedStaleness",
        maxIntervalInSeconds: 10,
        maxStalenessPrefix: 200,
    },
    offerType: "Standard",
    enableAutomaticFailover: true,
    geoLocations: [
        { location: config.location, failoverPriority: 0 },
        { location: config.failoverLocation, failoverPriority: 1 },
    ],
});

// Create secret from MongoDB connection string.
github pulumi / examples / azure-ts-cosmosapp-component / cosmosApp.ts View on Github external
offerType: "Standard",
            consistencyPolicy: {
                consistencyLevel: "Session",
                maxIntervalInSeconds: 300,
                maxStalenessPrefix: 100000,
            },
            enableMultipleWriteLocations: args.enableMultiMaster,
        }, parentOpts);

        const database = new azure.cosmosdb.SqlDatabase(`db-${name}`, {
            resourceGroupName: resourceGroup.name,
            accountName: cosmosAccount.name,
            name: args.databaseName,
        }, opts);

        const container = new azure.cosmosdb.SqlContainer(`sql-${name}`, {
            resourceGroupName: resourceGroup.name,
            accountName: cosmosAccount.name,
            databaseName: database.name,
        }, opts);

        // Traffic Manager as a global HTTP endpoint
        const profile = new azure.trafficmanager.Profile(`tm${name}`, {
            resourceGroupName: resourceGroup.name,
            trafficRoutingMethod: "Performance",
            dnsConfigs: [{
                // Subdomain must be globally unique, so we default it with the full resource group name
                relativeName: pulumi.interpolate`${name}${resourceGroup.name}`,
                ttl: 60,
            }],
            monitorConfigs: [{
                protocol: "HTTP",
github pulumi / examples / azure-ts-cosmosdb-logicapp / index.ts View on Github external
import * as azure from "@pulumi/azure";
import * as pulumi from "@pulumi/pulumi";

// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("logicappdemo-rg");

// Create an Azure resource (Storage Account)
const storageAccount = new azure.storage.Account("logicappdemosa", {
    resourceGroupName: resourceGroup.name,
    accountReplicationType: "LRS",
    accountTier: "Standard",
    accountKind: "StorageV2",
});

// Cosmos DB Account
const cosmosdbAccount = new azure.cosmosdb.Account("logicappdemo-cdb", {
    resourceGroupName: resourceGroup.name,
    location: resourceGroup.location,
    offerType: "Standard",
    geoLocations: [{ location: resourceGroup.location, failoverPriority: 0 }],
    consistencyPolicy: {
        consistencyLevel: "Session",
    },
});

// Cosmos DB Database
const db = new azure.cosmosdb.SqlDatabase("db", {
    resourceGroupName: resourceGroup.name,
    accountName: cosmosdbAccount.name,
});

// Cosmos DB SQL Container
github pulumi / examples / azure-ts-cosmosdb-logicapp / index.ts View on Github external
accountKind: "StorageV2",
});

// Cosmos DB Account
const cosmosdbAccount = new azure.cosmosdb.Account("logicappdemo-cdb", {
    resourceGroupName: resourceGroup.name,
    location: resourceGroup.location,
    offerType: "Standard",
    geoLocations: [{ location: resourceGroup.location, failoverPriority: 0 }],
    consistencyPolicy: {
        consistencyLevel: "Session",
    },
});

// Cosmos DB Database
const db = new azure.cosmosdb.SqlDatabase("db", {
    resourceGroupName: resourceGroup.name,
    accountName: cosmosdbAccount.name,
});

// Cosmos DB SQL Container
const dbContainer = new azure.cosmosdb.SqlContainer("container", {
    resourceGroupName: resourceGroup.name,
    accountName: cosmosdbAccount.name,
    databaseName: db.name,
});

/*
 * API Connection to be used in a Logic App
 */

// Calculate the subscription path

@pulumi/azure

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Nat

Apache-2.0
Latest version published 1 month ago

Package Health Score

87 / 100
Full package analysis