简体   繁体   中英

Get Azure Web/Function App authentication configuration using powershell

I'm trying to get azure function and webapp authentication settings using powershell, I'm using the latest az modules (5.1). I can't see a way of getting this information, if I use Get-AzFunctionApp I can't see any authentication settings being returned unless I'm missing something.

Azure CLI can recover this using az webapp auth show but I was hoping to do this natively if possible.

Thanks, Tim.

You can use the powershell cmdlet Invoke-AzResourceAction .

The example code:

Invoke-AzResourceAction -ResourceGroupName "your resource group name" -ResourceType "Microsoft.Web/sites/config" -ResourceName "your webapp name or function app name/authsettings" -Action list -Force

Note :

for -ResourceName , if your webapp name or function app name is mywebapp , then you should specify it like this: -ResourceName "mywebapp/authsettings" .

for -ResourceType , it's always "Microsoft.Web/sites/config" for both webapp or functionapp.

The test result:

在此处输入图像描述

You should be able to retrieve what you need using the following:

Get-AzFunctionApp -name "testFunction00001" -resourcegroupname "resourceGroup00001" | Select-Object -ExpandProperty {A} | fl

Substitute {A} with one of the following:

  • ApplicationSettings
  • SiteConfig
  • Config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM