https://pulumi.com logo
#azure
Title
# azure
c

cuddly-napkin-89521

12/07/2022, 12:50 PM
Hello Team, I hope you are doing great 🙂 I would like to ask for assistance, I am trying to create Function app in Azure via Pulumi/Typescript, function it self is made in Python, I would like to use storage account for place where code will be there. I have some code, but still not sure am I missing something. For git I use azure devops, and code is in different folder from azure cicd pipeline. For now I found azure.appservice.Plan for kind creating "FunctionApp" but I found in portal says Windows. Probably there is more issues. Thank you in advance
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as fs from "fs"
import * as path from "path"

export default function createETLFunction() {

const etlResourceGroup = new azure.core.ResourceGroup("rg-horizon-dev-etl", {
    location: "Westeurope",
    name: "rg-horizon-dev-etl",
});

const etlAppServicePlan = new azure.appservice.Plan("sp-horizon-dev-etl", {
    resourceGroupName: etlResourceGroup.name,
    name:"sp-horizon-dev-etl",
    kind: "Linux",
    sku: {
        size: "Y1",
        tier: "Dynamic",
    },
    kind: "FunctionApp"
},)

const etlStorageAccount = new azure.storage.Account("sahorizondevetl", {
    name: "sahorizondevetl",
    resourceGroupName: etlResourceGroup.name,
    location: etlResourceGroup.location,
    accountTier: "Standard",
    accountReplicationType: "LRS",
    minTlsVersion: "TLS1_2",
    isHnsEnabled: true,
    tags: {
        environment: "dev",
    },
});

const etlAppInsights = new azure.appinsights.Insights("etlAppInsights", {
    name : "etlAppInsights",
    resourceGroupName: etlResourceGroup.name,
    applicationType: "other",
});

new azure.appservice.ArchiveFunctionApp("faarc-horizon-etl-dev", {
    name:"faarc-horizon-etl-dev",
    plan: etlAppServicePlan,
    resourceGroupName: etlResourceGroup.name,
    archive: new pulumi.asset.FileArchive(path.resolve(__dirname, "../../services/horizon.etl")),
    version: "~4",
    
    appSettings: {
        FUNCTIONS_WORKER_RUNTIME: "python",
        APPINSIGHTS_INSTRUMENTATIONKEY: etlAppInsights?.instrumentationKey,
    },
    siteConfig: {
        linuxFxVersion: "python|3.7",
        minTlsVersion: "1.2",
        cors: {
            allowedOrigins: ['*']
        },
}})

const exampleFunctionApp = new azure.appservice.FunctionApp("fa-horizon-etl-dev", {
    name:"fa-horizon-etl-dev",
    resourceGroupName: etlResourceGroup.name,
    location: etlResourceGroup.location,
    appServicePlanId: etlAppServicePlan.id,
    storageAccountName: etlStorageAccount.name,
    storageAccountAccessKey: etlStorageAccount.primaryAccessKey,
});
}
6 Views