skip to Main Content

I am currently trying to use the Azure CLI to list the Function Apps and segregate them based on the security they are set up with.
If the app is set up with "Client Certificates" mechanism then it is being listed using the "az cli" functionapp commands. But, unable to figure out how to determine if the function app is secured with "OAuth" mechanism or not.

Is this something that is not directly available using the functionapp commands?

2

Answers


  1. To determine if an Azure Function App is secured with OAuth, you can use the Azure CLI command az functionapp auth show which will show the authentication settings for the function app. If OAuth is being used, it will be listed under the "Enabled Providers" section.

    Here’s an example command to list the authentication settings for a specific function app:

    az functionapp auth show --name <function-app-name> --resource-group <resource-group-name>
    
    

    If OAuth is being used, it will be listed under the "Enabled Providers" section.

    Check below Ref.

    Authentication types by deployment methods in Azure App Service

    Azure CLI conceptual article list (ref-zone3)

    Login or Signup to reply.
  2. You can check if Authorization is enabled by checking if Enabled is True for the following output:

    az webapp auth show --name <app-name> --resource-group <resource-group>
    

    This works for both Web Apps and Function Apps.

    If you want to loop through all the App Services in a particular Resource Group:

    $webapps = az webapp list -g <resource-group> | ConvertFrom-Json
    
    foreach ($webapp in $webapps)
    {
        $auth = az webapp auth show --name $webapp.name --resource-group <resource-group> | ConvertFrom-Json
    
        if ($auth.enabled)
        {
            $webAppName = $webapp.name
            $resourceGroupName = $webapp.resourceGroup
            $location = $webapp.location
    
            "--------------------------------------------------------------------"
            "WebApp: " + $webAppName + "      ResourceGroup: " + $webapp.resourceGroup + "      Location: " + $webapp.location
            
            "AllowedAudiences: " + $auth.allowedAudiences
            "ClientId: " + $auth.clientId
            "ConfigVersion: " + $auth.configVersion
            "Enabled: " + $auth.enabled
            "IsAuthFromFile: " + $auth.isAuthFromFile
            "Issuer: " + $auth.issuer
            "Name: " + $auth.name
            "RuntimeVersion: " + $auth.runtimeVersion
            "TokenStoreEnabled: " + $auth.tokenStoreEnabled
            "UnauthenticatedClientAction: " + $auth.unauthenticatedClientAction
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search