https://pulumi.com logo
Title
a

ambitious-crayon-56788

01/23/2020, 2:48 PM
Hey. I'm trying to output the host key for an Azure Function App after deployment, but I can't seem to get it to work. I've been referencing the documentation, which shows that the
getHostKeys()
method is available for the FunctionApp resource. I'm using the ArchiveFunctionApp resource, which doesn't specifically list the method, but I'm hoping that I can still access the keys somehow? • Documentation: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/azure/appservice/#FunctionApp-getHostKeys
"use strict";
const pulumi = require("@pulumi/pulumi");
const azure = require("@pulumi/azure");

// Create Storage Account (and container) and App Service Plan.
/// Removed to shorted example.

// Create a Function App and deploy code to it.
const functionApp = new azure.appservice.ArchiveFunctionApp("archiveFunctionApp", {
	name: "my-function-app",
	resourceGroupName: resourceGroup.name,
	archive: new pulumi.asset.FileArchive("MyFunctionApp"),
	plan: appServicePlan,
	account: storageAccount,
	container: storageContainer,
	version: "~2",
	appSettings: {
		FUNCTIONS_WORKER_RUNTIME: "powershell"
	}
});

exports.FunctionAppHostKeys = functionApp.getHostKeys();
t

tall-librarian-49374

01/23/2020, 3:40 PM
You can call it this way:
functionApp.functionApp.getHostKeys()
a

ambitious-crayon-56788

01/24/2020, 2:38 PM
@tall-librarian-49374 - Thanks, that works, although I ended up with
functionApp.functionApp.getHostKeys().functionKeys.default;
in order to get just the one key.