204001 - Failed to Log In to Azure
Uploading...Agent error code #204001 indicates that az login --service-principal failed. The agent authenticates to Azure with a service principal before every group of NSG operations, and Entra ID refused it.
Common causes include:
Steps to Resolve
Re-enter the Service Principal Credentials
Check the Secret Has Not Expired
Client secrets have a fixed lifetime and Azure does not warn the caller in advance.
Reproduce the Login by Hand
From the agent host:
sudo -u knocknoc az login --service-principal \
--username <client-id> --password <client-secret> --tenant <tenant-id>
The error this returns is the one the agent received.
Check Conditional Access
A Conditional Access policy that requires multi-factor authentication or a compliant device blocks a service principal sign-in. Check the Entra ID sign-in logs for the application and look for a policy-driven failure.