https://pulumi.com logo
Title
c

cuddly-napkin-89521

12/09/2022, 2:10 PM
Hello Team, If you can assist. I am trying to create function app with azure-native. For Pulumi, I am using type script and for function, python 3.8. I don't know, but function is not taking my paramiters, pulumi is giving me error. as I have created this resources in sandbox, I found informations in Resources JSON windows, and I change/copied needed parameters. Where am I doing wrong ? Error code :
Argument of type '{ name: string; resourceGroupName: Output<string>; script_href: string; config_href: string; test_data_href: string; href: string; script_root_path_href: string; language: string; config: { ...; }; }' is not assignable to parameter of type 'WebAppFunctionArgs'.
  Object literal may only specify known properties, but 'script_href' does not exist in type 'WebAppFunctionArgs'. Did you mean to write 'scriptHref'?
my code:
const etlFunctionApp = new web.WebAppFunction("fa-horizon-etl-dev-functionapp", {
        name: "fa-horizon-etl-dev-functionapp/data_validation",
        resourceGroupName: etlResourceGroup.name,
        script_href: "<https://func-horizon-dev-etl.azurewebsites.net/admin/vfs/home/site/wwwroot/data_validation/__init__.py>",
        config_href: "<https://func-horizon-dev-etl.azurewebsites.net/admin/vfs/home/site/wwwroot/data_validation/function.json>",
        test_data_href: "<https://func-horizon-dev-etl.azurewebsites.net/admin/vfs/home/data/Functions/sampledata/data_validation.dat>",
        href: "<https://func-horizon-dev-etl.azurewebsites.net/admin/functions/data_validation>",
        script_root_path_href: "<https://func-horizona-dev-etl.azurewebsites.net/admin/vfs/home/site/wwwroot/data_validation/>",
        language: "python",
        config: {
            scriptFile: "__init__.py",
            bindings: [
                {
                    name: "blob",
                    type: "blobTrigger",
                    direction: "in",
                    path: "uploaded-zone/{name}.json",
                    connection: "AzureWebJobsStorage"
                }
            ]
        },
    });
w

worried-rain-74420

12/09/2022, 4:00 PM
Have you tried changing
script_href
to
scriptHref
on line 4?
c

cuddly-napkin-89521

12/09/2022, 11:02 PM
@worried-rain-74420, thank you for your support, that was issue, as I copied from Resource JSON from sandbox env, I didn't realised my mistake. Anyway, now my function is failing because of something else. Also I will use this opportunity to ask you, do you know how can I configure AppInsights with FunctionApp ? Appreciate for your assistance 🙂
Diagnostics:
  azure-native:web:WebAppFunction (fa-horizon-etl-dev-functionapp):
    error: Code="ResourceNotFound" Message="The Resource 'Microsoft.Web/sites/fa-horizon-etl-dev-functionapp' under resource group 'rg-horizon-dev-etl' was not found. For more details please go to <https://aka.ms/ARMResourceNotFoundFix>"
This is how my file looks now. Maybe I am missing some config ?
import * as resources from "@pulumi/azure-native/resources";
import * as machinelearningservices from "@pulumi/azure-native/machinelearningservices";
import * as insights from "@pulumi/azure-native/insights";
import * as storage from "@pulumi/azure-native/storage";
import * as web from "@pulumi/azure-native/web";


export default function createETLFunction() {

    const etlResourceGroup = new resources.ResourceGroup("rg-horizon-dev-etl", {
        location: "westeurope",
        resourceGroupName: "rg-horizon-dev-etl",
    });
    const etlStorageAccount = new storage.StorageAccount("sahorizondevetl", {
        accountName: "sahorizondevetl",
        resourceGroupName: etlResourceGroup.name,
        sku: {
            name: storage.SkuName.Standard_LRS,
        },
        kind: storage.Kind.StorageV2,
        accessTier: "Hot",
        enableHttpsTrafficOnly: true,
        minimumTlsVersion: "TLS1_2",
    });


    const appServicePlan = new web.AppServicePlan("plan-horizon-dev-etl", {
        name: "plan-horizon-dev-etl",
        resourceGroupName: etlResourceGroup.name,
        location: etlResourceGroup.location,
        kind: "elastic",
        reserved: true,
        sku: {
            name: "EP1",
            tier: "ElasticPremium",
            size: "EP1",
            family: "EP",
            capacity: 1,
        },
    });

    const etlAppInsights = new insights.Component("ai-horizon-dev-appinsights", {
        resourceName: "ai-horizon-dev-appinsights",
        resourceGroupName: etlResourceGroup.name,
        location: etlResourceGroup.location,
        applicationType: "web",
        flowType: "Bluefield",
        kind: "web",
        requestSource: "rest",
    });

    const etlFunctionApp = new web.WebAppFunction("fa-horizon-etl-dev-functionapp", {
        name: "fa-horizon-etl-dev-functionapp/data_validation",
        functionName: "data_validation",
        resourceGroupName: etlResourceGroup.name,
        scriptHref: "<https://func-horizon-dev-etl.azurewebsites.net/admin/vfs/home/site/wwwroot/data_validation/__init__.py>",
        configHref: "<https://func-horizon-dev-etl.azurewebsites.net/admin/vfs/home/site/wwwroot/data_validation/function.json>",
        testDataHref: "<https://func-horizon-dev-etl.azurewebsites.net/admin/vfs/home/data/Functions/sampledata/data_validation.dat>",
        href: "<https://func-horizon-dev-etl.azurewebsites.net/admin/functions/data_validation>",
        scriptRootPathHref: "<https://func-horizona-dev-etl.azurewebsites.net/admin/vfs/home/site/wwwroot/data_validation/>",
        language: "python",
        config: {
            scriptFile: "__init__.py",
            bindings: [
                {
                    name: "blob",
                    type: "blobTrigger",
                    direction: "in",
                    path: "uploaded-zone/{name}.json",
                    connection: "AzureWebJobsStorage"
                }
            ]
        },
    });
}