Skip to content

Instantly share code, notes, and snippets.

@johlrich
johlrich / functionKey.ts
Created May 15, 2019 13:39
gets an azure function key
import { WebSiteManagementClient } from "@azure/arm-appservice"
import { AzureServiceClient } from "@azure/ms-rest-azure-js"
import { DefaultHttpClient, ServiceClientCredentials } from "@azure/ms-rest-js"
import axios from "axios"
export async function getFunctionKey(creds: ServiceClientCredentials, client: WebSiteManagementClient, group: string, name: string, keyName: string = "_master") {
// const token = await client.webApps.getFunctionsAdminToken(group, name)
// workaround to https://github.com/Azure/azure-sdk-for-js/issues/1008
const httpClient = new DefaultHttpClient()
const _ = (<any>httpClient).cookieJar = undefined