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.appservice 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-appservice-docker / index.ts View on Github external
adminEnabled: true,
});

const myImage = new docker.Image(customImage, {
    imageName: pulumi.interpolate`${registry.loginServer}/${customImage}:v1.0.0`,
    build: {
        context: `./${customImage}`,
    },
    registry: {
        server: registry.loginServer,
        username: registry.adminUsername,
        password: registry.adminPassword,
    },
});

const getStartedApp = new azure.appservice.AppService("get-started", {
    resourceGroupName: resourceGroup.name,
    appServicePlanId: plan.id,
    appSettings: {
      WEBSITES_ENABLE_APP_SERVICE_STORAGE: "false",
      DOCKER_REGISTRY_SERVER_URL: pulumi.interpolate`https://${registry.loginServer}`,
      DOCKER_REGISTRY_SERVER_USERNAME: registry.adminUsername,
      DOCKER_REGISTRY_SERVER_PASSWORD: registry.adminPassword,
      WEBSITES_PORT: "80", // Our custom image exposes port 80. Adjust for your app as needed.
    },
    siteConfig: {
        alwaysOn: true,
        linuxFxVersion: pulumi.interpolate`DOCKER|${myImage.imageName}`,
    },
    httpsOnly: true,
});
github pulumi / examples / azure-ts-msi-keyvault-rbac / index.ts View on Github external
requestedServiceObjectiveName: "S0",
});

// The connection string that has no credentials in it: authertication will come through MSI
const connectionString = pulumi.interpolate`Server=tcp:${sqlServer.name}.database.windows.net;Database=${database.name};`;

// A file in Blob Storage that we want to access from the application
const textBlob = new azure.storage.Blob("text", {
    storageAccountName: storageAccount.name,
    storageContainerName: storageContainer.name,
    type: "block",
    source: "./README.md",
});

// A plan to host the App Service
const appServicePlan = new azure.appservice.Plan("asp", {
    resourceGroupName: resourceGroup.name,
    kind: "App",
    sku: {
        tier: "Basic",
        size: "B1",
    },
});

// ASP.NET deployment package
const blob = new azure.storage.ZipBlob("zip", {
    storageAccountName: storageAccount.name,
    storageContainerName: storageContainer.name,
    type: "block",

    content: new pulumi.asset.FileArchive("./webapp/bin/Debug/netcoreapp2.2/publish"),
});
github pulumi / examples / azure-ts-functions-raw / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

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

// Create a resource group for Windows App Service Plan
const resourceGroup = new azure.core.ResourceGroup("windowsrg");

const dotnetApp = new azure.appservice.ArchiveFunctionApp("http-dotnet", {
    resourceGroup,
    archive: new pulumi.asset.FileArchive("./dotnet/bin/Debug/netcoreapp2.1/publish"),
    appSettings: {
        "runtime": "dotnet",
    },
});

const nodeApp = new azure.appservice.ArchiveFunctionApp("http-node", {
    resourceGroup,
    archive: new pulumi.asset.FileArchive("./javascript"),
});

const powershellApp = new azure.appservice.ArchiveFunctionApp("http-powershell", {
    resourceGroup,
    archive: new pulumi.asset.FileArchive("./powershell"),
    appSettings: {
github pulumi / examples / azure-ts-functions / azureFunction.ts View on Github external
this.codeBlobUrl = azure.storage.signedBlobReadUrl(this.blob, this.storageAccount);

        this.appServicePlan = new azure.appservice.Plan(`${name}-p`, {
            ...resourceGroupArgs,
        
            kind: "FunctionApp",
        
            // https://social.msdn.microsoft.com/Forums/azure/en-US/665c365d-2b86-4a77-8cea-72ccffef216c
            sku: {
                tier: "Dynamic",
                size: "Y1",
            },
        }, parentArgs);

        this.functionApp = new azure.appservice.FunctionApp(`${name}-app`, {
            ...resourceGroupArgs,
        
            appServicePlanId: this.appServicePlan.id,
            storageConnectionString: this.storageAccount.primaryConnectionString,
        
            appSettings: {
                "WEBSITE_RUN_FROM_ZIP": this.codeBlobUrl,
            },
        }, parentArgs);

        this.endpoint = this.functionApp.defaultHostname.apply(h => {
            return `https://${h}/api/${name}`;
        });
    }
};
github pulumi / examples / azure-ts-api-management / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

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

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

// Create an HTTP Azure Function which will be the "backend" of our API.
// It accepts a name in the query string and returns a JSON back with the greeting and timestamp.
const httpFunction = new azure.appservice.HttpEventSubscription("greeting-func", {
    resourceGroup,
    callback: async (context, request) => {
        return {
            status: 200,
            headers: {
                "content-type": "application/json",
            },
            body: {
                time: new Date(),
                greeting: `Hello ${request.query["name"] || "friend"}!`,
            },
        };
    },
});

// Create an API Management Service instance
github pulumi / examples / azure-ts-serverless-url-shortener-global / index.ts View on Github external
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",
        port: 80,
        path: "/api/ping",
    }],
});

// Azure Function to accept new URL shortcodes and save to Cosmos DB
const fn = new azure.appservice.HttpEventSubscription("AddUrl", {
    resourceGroup,
    location: primaryLocation,
    methods: ["POST"],
    callbackFactory: () => {
        const endpoint = account.endpoint.get();
        const key = account.primaryMasterKey.get();

        const client = new CosmosClient({ endpoint, key, connectionPolicy: { preferredLocations: [primaryLocation] } });
        const container = client.database(database.name.get()).container(collection.name.get());
        return async (_, request: azure.appservice.HttpRequest) => {
            await container.items.create(request.body);
            return { status: 200, body: "Short URL saved" };
        };
    },
});
export const addEndpoint = fn.url;
github pulumi / examples / azure-ts-functions-raw / index.ts View on Github external
const resourceGroup = new azure.core.ResourceGroup("windowsrg");

const dotnetApp = new azure.appservice.ArchiveFunctionApp("http-dotnet", {
    resourceGroup,
    archive: new pulumi.asset.FileArchive("./dotnet/bin/Debug/netcoreapp2.1/publish"),
    appSettings: {
        "runtime": "dotnet",
    },
});

const nodeApp = new azure.appservice.ArchiveFunctionApp("http-node", {
    resourceGroup,
    archive: new pulumi.asset.FileArchive("./javascript"),
});

const powershellApp = new azure.appservice.ArchiveFunctionApp("http-powershell", {
    resourceGroup,
    archive: new pulumi.asset.FileArchive("./powershell"),
    appSettings: {
        "runtime": "powershell",
    },
});

const javaApp = new azure.appservice.ArchiveFunctionApp("http-java", {
    resourceGroupName: resourceGroup.name,
    archive: new pulumi.asset.FileArchive("./java/target/azure-functions/fabrikam-functions"),
    appSettings: {
        "runtime": "java",
    },
});

// Create a dedicated resoure group for Linux App Service Plan - require for Python
github pulumi / examples / azure-ts-serverless-url-shortener-global / index.ts View on Github external
const key = account.primaryMasterKey.get();

        const client = new CosmosClient({ endpoint, key, connectionPolicy: { preferredLocations: [primaryLocation] } });
        const container = client.database(database.name.get()).container(collection.name.get());
        return async (_, request: azure.appservice.HttpRequest) => {
            await container.items.create(request.body);
            return { status: 200, body: "Short URL saved" };
        };
    },
});
export const addEndpoint = fn.url;

for (const location of locations) {

    // URL redirection function - one per region
    const fn = new azure.appservice.HttpEventSubscription(`GetUrl-${location}`, {
        resourceGroup,
        location,
        route: "{key}",
        callbackFactory: () => {
            const endpoint = account.endpoint.get();
            const key = account.primaryMasterKey.get();

            const client = new CosmosClient({ endpoint, key, connectionPolicy: { preferredLocations: [location] } });
            const container = client.database(database.name.get()).container(collection.name.get());
            return async (_, request: azure.appservice.HttpRequest) => {
                const key = request.params["key"];
                if (key === "ping") {
                    // Handle traffic manager live pings
                    return { status: 200, body: "Ping ACK" };
                }
github pulumi / examples / azure-ts-appservice-devops / infra / index.ts View on Github external
const sqlServer = new azure.sql.SqlServer(`${prefix}-sql`, {
    ...resourceGroupArgs,

    administratorLogin: username,
    administratorLoginPassword: pwd,
    version: "12.0",
});

const database = new azure.sql.Database(`${prefix}-db`, {
    ...resourceGroupArgs,
    serverName: sqlServer.name,
    requestedServiceObjectiveName: "S0",
});

const app = new azure.appservice.AppService(`${prefix}-as`, {
    ...resourceGroupArgs,

    appServicePlanId: appServicePlan.id,


    appSettings: {
        "WEBSITE_RUN_FROM_ZIP": codeBlobUrl,
        "ApplicationInsights:InstrumentationKey": appInsights.instrumentationKey,
        "APPINSIGHTS_INSTRUMENTATIONKEY": appInsights.instrumentationKey,
        "ASPNETCORE_ENVIRONMENT": "Development",
    },

    connectionStrings: [{
        name: "MyDbConnection",
        value:
            pulumi.all([sqlServer.name, database.name]).apply(([server, db]) =>
github pulumi / examples / azure-ts-functions / index.ts View on Github external
let body = "";
    const headers = request.headers;
    for (const h of Object.keys(request.headers)) {
        body = body + `${h} = ${headers[h]}\n`;
    }

    return {
        status: 200,
        headers: {
            "content-type": "text/plain",
        },
        body: `Greetings from Azure Functions!\n\n===\n\n${body}`,
    };
}

const fn = new azure.appservice.HttpEventSubscription("fn", {
    resourceGroup,
    callback: handler,
});

export let endpoint = fn.url;

@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