Way to get Azure Function default key with ARM output or powershell


I'm attempting to set up integration testing for an Azure Function app. Deployment is going fine, but I need a way to programatically get the default key to run my integration tests.

I've tried what is linked here - <a href="https://stackoverflow.com/questions/43253453/get-function-host-keys-of-azure-function-in-powershell" rel="nofollow">Get Function & Host Keys of Azure Function In Powershell</a> - but cannot get the listsecrets working in my ARM deployment template. Listsecrets is not recognized.

Does anyone know how to get this key with an ARM template and/or powershell?


I ended up being able to run an Azure Powershell script in a VSTS task and output the variable to a build key. I am attaching the script so others can use.

#Requires -Version 3.0 Param( [string] [Parameter(Mandatory=$true)] $ResourceGroup, [string] [Parameter(Mandatory=$true)] $FunctionAppName ) $content = Get-AzureRmWebAppPublishingProfile -ResourceGroupName $ResourceGroup -Name $FunctionAppName -OutputFile creds.xml -Format WebDeploy $username = Select-Xml -Content $content -XPath "//publishProfile[@publishMethod='MSDeploy']/@userName" $password = Select-Xml -Content $content -XPath "//publishProfile[@publishMethod='MSDeploy']/@userPWD" $accessToken = "Basic {0}" -f [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password))) $masterApiUrl = "https://$FunctionAppName.scm.azurewebsites.net/api/functions/admin/masterkey" $masterKeyResult = Invoke-RestMethod -Uri $masterApiUrl -Headers @{"Authorization"=$accessToken;"If-Match"="*"} $masterKey = $masterKeyResult.Masterkey $functionApiUrl = "https://$FunctionAppName.azurewebsites.net/admin/host/keys?code=$masterKey" $functionApiResult = Invoke-WebRequest -UseBasicParsing -Uri $functionApiUrl $keysCode = $functionApiResult.Content | ConvertFrom-Json $functionKey = $keysCode.Keys[0].Value $saveString = "##vso[task.setvariable variable=FunctionAppKey;]{0}" -f $functionKey Write-Host ("Writing: {0}" -f $saveString) Write-Output ("{0}" -f $saveString)


  • Choose Nuget Packager version in Visual Studio Team Services build step
  • VSTS - App Center - Yaml - Endpoint could not be found
  • Generating passwords for the Azure Api Management Git repository
  • Through presenting new view controller viewWillDisappear on parent is triggered where I unsubscribe
  • LibGit2Sharp and Authentication UI
  • How to detect left mouse click but not when the click occur on a UI Button component [closed]
  • Arduino making decision according to a packet received from serial port
  • CloseOptionsMenu doesn't work?
  • Is there a way to choose which files are displayed to the user via the standard OPENFILE dialogs?
  • python: forcing relative imports to search from script file
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • Unable to connect to OnVif enabled camera using C#
  • .NET video play library which allows to change the playback rate?
  • how to get data attributes of dynamically generated element
  • Getting different value with placeholder over CPU/GPU
  • Doctrine2 bulk import try to work with another entity
  • Passing “get” parameters doesn't work, parameter not visible in the link
  • How to make R's read_csv2() recognise the text characters properly
  • Firefox Extension - Monitor refresh and change of tab
  • Declaring variable dynamically in VB.net
  • DomPDF {PAGE_NUM} not on first page
  • Is there a javascript serializer for JSON.Net?
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Javascript simulate pressing enter in input box
  • Azure Cloud Service Web Role web pages do not load
  • Submit form in a displaytag pagination
  • Deserializing XML into class C#
  • Convert array of 8 bytes to signed long in C++
  • Importing jscolor library in angular 2
  • AT Commands to Send SMS not working in Windows 8.1
  • A cron job substitute?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • How to include full .NET prerequisite for Wix Burn installer
  • -fvisibility=hidden not passed by compiler for Debug builds
  • apache spark aggregate function using min value
  • Does armcc optimizes non-volatile variables with -O0?
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize