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

chilly-crayon-19101

05/25/2020, 9:12 PM
Hi all, hopefully a real quick question I have successfully managed to get my Azure Function App deployed using C# and .net however I am struggling to find an easy way to list the host function keys for downstream process? I am sure I am missing something simple. Thanks 🙂
Copy code
var app = new FunctionApp("app", new FunctionAppArgs
        {
            Name = $"{config.FullName}",
            ResourceGroupName = resourceGroup.Name,
            AppServicePlanId = appServicePlan.Id,
            AppSettings =
            {
                {"runtime", "dotnet"},
                {"WEBSITE_RUN_FROM_PACKAGE", codeBlobUrl},
                {"CvApiDataConnectionString", apiStorageAccount.PrimaryConnectionString},
                {"GetBlobPath", "curriculumvitae/{id}.json"},
                {"ContainerName", "curriculumvitae"}
            },
            StorageConnectionString = functionAppStorageAccount.PrimaryConnectionString,
            Version = "~3"
        });

        this.Endpoint = Output.Format($"https://{app.DefaultHostname}");
k

kind-mechanic-53546

05/26/2020, 12:51 AM
I think this should do it
Copy code
export const appHostMasterKey = app.functionApp   .getHostKeys().apply((keys) => keys.masterKey);
That was from an
ArchiveFunctionApp
though, so a
FunctionApp
might be slightly different
c

chilly-crayon-19101

05/26/2020, 8:46 PM
Sorry for the delay in replying. I am using the .net Pulumi packages and I still cannot find any options similar to above for listing keys. I have rooted around in the source code and still not seeing it. Should I be expecting parity across the languages?
k

kind-mechanic-53546

05/26/2020, 11:59 PM
yep, you're right
so an app is just a logical container for functions?
Have to take a step back. What are you trying to accomplish here? What keys and what are they for?
c

chilly-crayon-19101

05/27/2020, 4:16 AM
I was aiming to run some quick smoke tests as part CI to verify the deployment of my HTTP triggered functions that expect the key as part of the request. So to do so I require the functions host key. I was hoping I could output it and use as part of the test config. I guess a more correct way of doing it would be to create a key vault and use that as the config source. However that would still need to list out the keys to populate.
k

kind-mechanic-53546

05/27/2020, 4:18 AM
I think your individual functions within your app would have host keys
c

chilly-crayon-19101

05/30/2020, 7:44 AM
Yeah I understand that but after more rooting in the .net source code it seems the getHostKeys or similar is not there. Probably going to give a rewrite into Typescript a try. Thanks for the pointers.