Here’s a comprehensive solution to resolve your IAM policy blocking issue:
Root Cause:
Your service ID has ‘Editor’ role on the resource group, which allows managing resources but NOT managing IAM policies or service IDs. Your supplier onboarding workflow requires IAM administration permissions that were never properly configured, and the issue became apparent after API key rotation triggered fresh authorization checks.
Solution:
Step 1: IAM Policy Evaluation - Identify Missing Permissions
Query Activity Tracker to find denied actions:
Filter: initiator.id=SERVICE_ID_CRN AND outcome=failure
Look for actions:
- iam-identity.serviceid.create (requires Operator/Editor on IAM Identity)
- iam-identity.policy.create (requires Administrator on IAM Identity)
- iam-groups.member.add (requires Administrator on Access Groups)
- resource-controller.instance.create (requires Editor on Resource Group)
The Activity Tracker events will show:
{
"action": "iam-identity.policy.create",
"outcome": "failure",
"reason": {"reasonCode": 403, "reasonType": "Forbidden"},
"message": "Insufficient permissions to create policy"
}
Step 2: Service Credential Rotation - Verify Configuration
Confirm the new API key is properly configured:
# Verify API key belongs to correct service ID
ibmcloud iam service-api-key SERVICE_ID --output json | jq '.[] | select(.name=="YOUR_KEY_NAME")'
# Test API key authentication
curl -X GET https://iam.cloud.ibm.com/v1/apikeys/details \
-H "Authorization: Bearer $(ibmcloud iam oauth-tokens | grep IAM | cut -d: -f2)"
Ensure your application is using the new API key (not cached old key):
- Check environment variables: `echo $IBMCLOUD_API_KEY
- Verify application config files
- Restart application services to clear any in-memory credential caches
Step 3: Activity Tracker Log Analysis - Grant Required Permissions
Based on Activity Tracker findings, add necessary IAM policies:
For creating service IDs:
ibmcloud iam service-policy-create SERVICE_ID \
--roles Operator \
--service-name iam-identity
For assigning IAM policies (required for supplier onboarding):
ibmcloud iam service-policy-create SERVICE_ID \
--roles Administrator \
--service-name iam-identity
For managing access groups:
ibmcloud iam service-policy-create SERVICE_ID \
--roles Administrator \
--service-name iam-groups
Keep existing resource group Editor role for creating service instances:
ibmcloud iam service-policy-create SERVICE_ID \
--roles Editor \
--resource-group-name YOUR_RESOURCE_GROUP
Complete Policy Set for Supplier Onboarding Automation:
- Resource Group - Editor: Create/manage service instances for suppliers
- IAM Identity Service - Administrator: Create service IDs and assign policies to them
- Access Groups Service - Administrator: Add supplier service IDs to access groups
- Resource Controller - Editor: Provision and configure cloud resources
- Activity Tracker - Viewer (optional): Allow workflow to query its own audit logs
Validation:
Test your supplier onboarding workflow:
# Simulate workflow steps with new credentials
1. Create test service ID: Should succeed
2. Assign policy to test service ID: Should succeed
3. Create test service instance: Should succeed
4. Add to access group: Should succeed
Monitor Activity Tracker during test:
Filter: initiator.id=SERVICE_ID_CRN AND outcome=success
Verify actions:
- iam-identity.serviceid.create (outcome=success)
- iam-identity.policy.create (outcome=success)
- resource-controller.instance.create (outcome=success)
Why It Worked Before:
Likely scenarios:
- Old API key had temporary elevated permissions that weren’t documented
- Policy changes occurred simultaneously with credential rotation
- Workflow recently added new automation steps requiring IAM administration
- Authorization cache masked the permissions gap with old credentials
Best Practices:
- Document Service ID Policies: Maintain a policy matrix showing which service IDs need which roles for automation workflows
- Test After Rotation: Always test automated workflows immediately after credential rotation in a non-production environment
- Use Activity Tracker Proactively: Set up alerts for authorization failures (outcome=failure + reasonCode=403)
- Least Privilege: Only grant Administrator role on services where policy management is required (IAM Identity, Access Groups)
- Credential Rotation Schedule: Rotate API keys regularly (90 days) and maintain runbooks for post-rotation validation
- Separate Service IDs: Consider using different service IDs for different automation tasks to limit blast radius if credentials are compromised
After applying these policies, your supplier onboarding automation should work correctly with the new API key, and you’ll have proper audit trails in Activity Tracker showing successful IAM operations.