Testing and troubleshooting Azure Serverless Scanning Failures (403 Forbidden) for Private Function Apps.

Testing and troubleshooting Azure Serverless Scanning Failures (403 Forbidden) for Private Function Apps.

195
Created On 10/18/26 19:14 PM - Last Modified 11/16/26 20:55 PM


Symptom


  • Serverless scans for Azure Function Apps fail to complete.
  • System logs or error messages display a 403 Forbidden error when the scanner attempts to reach the Kudu/SCM endpoint.
    • Example Error: failed to download code via Kudu... http request returned HTTP 403 - The web app you have attempted to reach has blocked your access.
  • The cloud_health_auditing dataset shows classification = Failed for the Serverless capability, or the function does not show a recent scan time under Inventory > Assets > Serverless Functions.

     



Environment


  • Cortex Cloud
  • Microsoft Azure
  • Azure Serverless Functions (Function Apps)


Cause


By default, Cortex Cloud performs serverless scanning from a public environment. When an Azure Function App is secured behind a Private Endpoint or has Access Restrictions blocking the SCM (Kudu) endpoint, the Cortex scanner is actively blocked by Azure's firewall, resulting in a 403 Forbidden error.

To bypass this, Cortex utilizes a feature called Private Serverless Scanning, which attempts to directly access the function's underlying storage account using a dynamically generated private endpoint. However, scans will still fail if:

  1. Unsupported Storage Architecture: The deployment package is stored on the Function App's local file system. Private functions must be backed by remote storage (Azure Blob or Azure Files).
  2. Missing Permissions: The Cortex Service Principal lacks the permissions required to approve the temporary private endpoint connection to the storage account.



Resolution


To successfully scan private Azure Functions, ensure the environment meets the architectural limitations and the correct permissions are applied.

1. Verify the Function Storage Architecture (Limitation Check)

  • Public Azure Functions: Packages stored on the local file system are supported. The scanner downloads the code via the accessible Kudu/SCM endpoint.
  • Private Azure Functions: Packages stored on the local file system are NOT supported. Because the Kudu/SCM endpoint returns HTTP 403, the scanner must retrieve the package directly from storage. The function must be configured to use remote storage (Azure Blob Storage or Azure Files). If there is no remote storage configured, the scanner has no way to retrieve the package.

2. Verify Azure Role Permissions Ensure the Custom Role assigned to the Cortex Cloud Service Principal in Azure includes the following required permissions:

  • Microsoft.Web/sites/publishxml/action
  • Microsoft.Web/sites/config/list/action
  • Microsoft.Web/sites/read
  • Microsoft.Storage/storageAccounts/PrivateEndpointConnectionsApproval/action (Critical for Private Serverless Scanning to approve the temporary private link).

3. Verify Scan Execution via XQL Once permissions and storage are corrected, trigger a scan and verify the execution using the Cortex Query Builder:

  • To check the scan classification for a specific connector:
config timeframe = 7d | dataset = cloud_health_auditing | filter connector = "CONNECTOR_NAME" | filter capability = "Serverless"
  • To search for a specific function name across the environment:

config timeframe = 30d 
| dataset = cloud_health_auditing 
| filter capability = "Serverless" 
| filter name contains "function-name-"
Note: A classification of "Success" confirms the function was scanned.

4. Check Last Discovered Time in Inventory: You can also verify the asset discovery and scan time via the UI: Navigate to Inventory > Assets > Serverless Functions > Click on the relevant function to determine the last discovered time and last scan time.



Additional Information


If you need to force Cortex Cloud to scan the function immediately without waiting for the scheduled discovery, you can trigger a change event in Azure by adding a dummy App Setting (Environment Variable) to the Function App. This updates the configuration timestamp and queues a new scan.

Known limitations for Private Serverless Scanning:

  • Storage Account Versions: Storage Account V1 (General Purpose v1) is not supported. The function must be backed by a Storage Account V2 (General Purpose v2). Note: V1 accounts can easily be upgraded to V2 in-place within the Azure Portal without any downtime.
  • Unsupported Hosting Plans: The newer Azure Flex Consumption plan is currently not supported for Private Serverless Scanning.
  • Discovery Misclassification: There is a known issue where certain private functions may accidentally be discovered and classified as public functions by the discovery engine. The engineering team is actively working on a fix for this behavior.
  • CRITICAL - Scan Triggering for Legacy Assets: If an Azure Function was already discovered by Cortex before the Private Serverless Scanning toggle was enabled on the cloud account, it may fail to automatically re-trigger the scan using the new private architecture. If this occurs, backend assistance is required. Please escalate the case so the engineering/support team can manually re-trigger the scans for those private functions.


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000000RhlCAE&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail