hiddenlayer-apim setup and deployment issues.
Azure Authentication Fails
Run:AZURE_SUBSCRIPTION_ID in .env.
APIM Resource Is Not Found
Check these settings:Azure Returns 401, 403, or AuthorizationFailed
AuthorizationFailed, 403 Forbidden, or 401 from any Microsoft.ApiManagement call means the signed-in identity is missing one of the required APIM actions.
Confirm the signed-in identity:
Deploy Stops Because a Resource Already Exists
hiddenlayer-apim deploy is non-destructive by default. It creates missing HiddenLayer resources and leaves matching resources unchanged. If an existing non-secret named value or policy fragment has different content, the command stops instead of overwriting it.
Review the existing APIM resource. If you intentionally want the CLI to replace HiddenLayer-managed named values or fragments, run:
--overwrite would change something, the CLI lists the affected named values and policy fragments and prompts for yes before continuing. Secret named values are listed by name only; their values are not displayed.
Existing secret named values are skipped unless --overwrite is used because Azure does not return secret values for comparison.
Apply Reports apply cancelled
hiddenlayer-apim apply previews the inbound and outbound fragments it will inject and waits for yes before updating the APIM policy. Any other input, an empty line, or no available stdin cancels the run. Type yes to confirm, or pass --yes to skip the prompt in non-interactive environments such as CI:
Remove Reports remove cancelled
hiddenlayer-apim remove previews the fragment IDs it will delete and waits for yes. Any other input, an empty line, or no available stdin cancels the run. Type yes to confirm, or pass --yes to skip the prompt:
Remove Does Not Detect Any Fragments
hiddenlayer-apim remove only removes HiddenLayer fragments that match the selected package (or every detected HiddenLayer fragment with --all). It reports No removable HiddenLayer fragments found in policy when:
- The API policy has no HiddenLayer
<include-fragment>references. - You selected a
--package/--packageswhose fragments are not present in the API policy. In that case, list what is actually applied and re-select the correct package:
--all cannot be combined with --package or --packages. Use one or the other.
Apply Reports Missing Fragments
Run deploy first:Wrong Package Is Selected
Set the package explicitly:.env:
--packages when you want request and response evaluation together:
HiddenLayer API Calls Use the Wrong Region
SetHL_HOST for your HiddenLayer environment:
--overwrite if the APIM named value already exists:
Runtime Action Header Is Missing
HL-Runtime-Action is set to BLOCK only when HiddenLayer blocks a request or response. For allow, detect, or redact outcomes, the header can be empty.
Use curl -i or equivalent tooling to inspect response headers:
Response Evaluation Does Not Run
The response evaluation package skips:- model discovery requests such as
GET /v1/models - streaming requests
- non-JSON responses
- empty responses

