Based on the error message “Bad Request: Request Too Long”, this behavior typically occurs when the authentication request is rejected before the deployment reaches the Azure Resource Manager (ARM) provisioning stage.
When a deployment request is sent to Azure Resource Manager, the request includes an authentication token in the HTTP header. In certain scenarios, this token can become excessively large due to factors such as:
Membership in a large number of Microsoft Entra ID groups
A high number of RBAC role assignments
Accumulated authentication cookies or additional claims
If the Authorization header exceeds the allowed size limit, Azure Resource Manager rejects the request and returns the HTTP 400 – Request Too Long error before any resource provisioning begins. This explains why the deployment fails immediately even though the VM configuration itself is valid.
To further validate and mitigate this behavior, we recommend the following steps:
1.Test deployment with a new user account
Create a new Microsoft Entra ID user with minimal group memberships and assign Owner or Contributor permissions to the subscription. If the deployment succeeds with this account, it would confirm that the issue is related to authentication token size.
- Review and reduce group memberships
If the affected user belongs to a large number of Entra ID groups, removing unnecessary or redundant group memberships can help reduce the authentication token size.
- Restrict group claims in the token
Work with your Entra ID administrator to configure the groups claim to emit only “Groups assigned to the application” instead of all groups. This limits the number of group claims included in the authentication token.
- Consider using application roles instead of groups
Where possible, replace group-based access control with application roles, which produce smaller and more efficient claims in the authentication token.
- Use a dedicated service principal for deployments
If deployments are being performed by a user account with extensive group memberships, consider creating a dedicated service principal with only the required RBAC permissions and minimal group associations.
Also, could you please try the deployment from InPrivate window.
These approaches can help reduce the authentication token size and prevent the “Request Too Long” error when sending requests to Azure Resource Manager.
Reference:
Azure Portal: Bad Request - Request Too Long
Hope this helps! Please let me know if you have any queries.