When it is written
IAM writes this Admin Activity entry when CreateServiceAccountKey is called for the account in request.name; the IAM audit logging page lists it with the permission iam.serviceAccountKeys.create, which Service Account Key Admin (roles/iam.serviceAccountKeyAdmin) grants. Google notes that the basic roles can carry the permission too. Google creates the key pair, keeps the public key, and returns the private key once, in the response; it can't be downloaded again. The request can set the key's format (private_key_type, a credentials JSON file by default) and algorithm.
An account holds at most 10 keys. Keys don't expire unless the iam.serviceAccountKeyExpiryHours organization policy sets a lifetime for newly created keys. Where iam.disableServiceAccountKeyCreation is enforced, the call fails, and Google documents the error as FAILED_PRECONDITION. Google enforces that constraint by default in organizations created on or after 3 May 2024, and describes exempting single projects or folders from it with a tag. The managed constraint iam.managed.disableServiceAccountKeyCreation blocks key creation in the same way; Google gives no error text for it.
Google's example entry has resource.type service_account and shows the request, not the response; its AuditLog reference says sensitive response data can be left out, so the private key is not expected in the log. The API's response is the new key, whose name ends in the key ID; Google does not show whether the entry keeps it. Calls made later with the key in general name it in authenticationInfo.serviceAccountKeyName; Google notes that some services, App Engine and Compute Engine among them, do not log the key name.
How to turn it on
Google Cloud Audit Logs records google.iam.admin.v1.CreateServiceAccountKey calls to iam.googleapis.com without any setup. Vendor documentation
Admin Activity audit logs (changes to the configuration or metadata of a resource, such as allow policies, service accounts and keys) are written in every project, folder and organization without any setup. They can't be turned off or excluded, cost nothing, and are kept for 400 days in the _Required log bucket, a period you can't change. Data Access audit logs are off by default for every service except BigQuery: they cover reading configuration or metadata (ADMIN_READ) and reading or writing user data (DATA_READ, DATA_WRITE). Turn them on per service, or for all services, in the auditConfigs section of the IAM policy of the organization, folder or project; a project inherits what its folder and organization turn on and can't turn it off. A principal can be exempted per service and log type (exemptedMembers), and its calls then write no Data Access entry. They go to the _Default bucket, kept for 30 days by default, and can add charges.
- Google Workspace and Cloud Identity audit logs (Admin, Login, Groups, OAuth token and SAML events) reach Cloud Logging only after a super administrator turns on sharing with Google Cloud: Admin console > Account > Account settings > Legal and compliance > Sharing options > Enabled. They are written at the organization level (
organizations/<org-id>/logs/...), and which of them are shared depends on the edition. Admin audit events are Admin Activity entries. - To keep the records longer and send them to a SIEM, route them with a sink: an aggregated sink at the organization collects the entries of every folder and project under it, to Pub/Sub, Cloud Storage, BigQuery or a log bucket.
- The Logs Viewer role (
roles/logging.viewer) reads Admin Activity entries; Data Access entries in_Defaultneed Private Logs Viewer (roles/logging.privateLogViewer). - The lookup command reads one project. Organization-level entries (Workspace and Cloud Identity, and changes made on an organization or folder) are read with
--organization=<org-id>or--folder=<folder-id>in its place. - Google gives no delivery delay for Cloud Audit Logs; Workspace states that shared data arrives in near real time.
gcloud projects get-iam-policy <project-id> --format="yaml(auditConfigs)"gcloud organizations get-iam-policy <org-id> --format="yaml(auditConfigs)"gcloud logging sinks list --organization=<org-id>gcloud logging buckets list --project=<project-id>gcloud logging read 'protoPayload.methodName="google.iam.admin.v1.CreateServiceAccountKey"' --project=<project-id> --freshness=7d --limit=5Fields
The operation’s own fields first, then the fields every Google Cloud Audit Logs record has. Field names are the JSON paths of the record as the vendor documents it.
| Field | What it holds |
|---|---|
protoPayload. | The service account the key is for, projects/<project or ->/serviceAccounts/<email or unique ID> (shown in Google's example). |
protoPayload. | The format of the private key returned (the API's privateKeyType, written here in the snake_case of Google's IAM admin entries; not shown in Google's example). Default TYPE_GOOGLE_CREDENTIALS_FILE. |
resource. | The email address of the service account (resource.type is service_account). |
resource. | The numeric unique ID of that service account. |
Fields every Google Cloud Audit Logs record has (22)
| Field | What it holds |
|---|---|
logName | The log the entry belongs to: the project, folder or organization, then cloudaudit.googleapis.com%2Factivity (Admin Activity), %2Fdata_access, %2Fsystem_event or %2Fpolicy (Policy Denied). |
resource. | The kind of monitored resource the entry is about (project, service_account, audited_resource...). |
resource. | The labels that identify that resource; which ones depends on resource.type (project_id, email_id...). |
timestamp | When the operation took place. |
receiveTimestamp | When Cloud Logging received the entry; later than timestamp. |
severity | The severity of the entry (NOTICE for most audit entries, ERROR for many failed calls). |
insertId | An identifier Cloud Logging gives the entry, unique within the log. |
protoPayload.Read by 1 rule | The API service the operation was performed by (iam.googleapis.com, admin.googleapis.com). |
protoPayload.Read by 1 rule | The method that was called, usually the API method name. The operation this page is about. |
protoPayload. | The resource the operation targets, as a path without the service name (projects/<id>/serviceAccounts/<email>). |
protoPayload. | The account that made the request: a user, a service account, or the service account acting for an external identity. Never redacted for a write or a call that succeeded; a read that failed with permission denied can hide it, unless the caller is a service account. |
protoPayload. | For a request made with service account credentials obtained by impersonation, the chain of principals that delegated to it, in the order the delegation happened. |
protoPayload. | The service account key used to create or exchange the credentials, when one was. |
protoPayload. | One entry per resource and IAM permission checked, with granted true or false. |
protoPayload. | The address the request came from. Google replaces some internal and VM callers with placeholder values (private, gce-internal-ip). |
protoPayload. | The client's user agent as the caller sent it; not authenticated. |
protoPayload. | The result as a google.rpc.Code number: absent or 0 when the call succeeded, 7 (PERMISSION_DENIED), 5 (NOT_FOUND) and others when it failed. |
protoPayload. | The error message of a failed call. |
protoPayload. | The request, as the service's API reference documents it; large, sensitive or duplicated parameters can be left out. |
protoPayload. | The response, with the same limits as request. |
protoPayload. | Other data the service records about the operation. Google Workspace entries put the Admin console event here (event: eventName, eventType and its parameter list). |
protoPayload. | The older place for service-specific data, deprecated in favour of metadata but still written by some services. |
Values to know
protoPayload.status.message
| Value | Meaning | Signal |
|---|---|---|
Key creation is not allowed on this service account | The `iam.disableServiceAccountKeyCreation` policy blocked the callThe guardrail worked; repeated attempts, or a policy change soon after, are worth a look. Google documents this text as the error the caller receives and shows no audit entry of a blocked call, so confirm the text on a record of your own. | Failure |
protoPayload.status.code
| Value | Meaning | Signal |
|---|---|---|
7 | PERMISSION_DENIEDThe caller lacks iam.serviceAccountKeys.create on the account. Google's API reference says a request that names the project as - gets a 403 in place of a 404 for an account that does not exist, so a denied call can also be a wrong account name. | Failure |
9 | FAILED_PRECONDITIONThe status Google documents for a call that the iam.disableServiceAccountKeyCreation policy blocks. | Failure |
Volume and noise
Low where keys are discouraged: Google recommends Workload Identity Federation over keys for workloads outside Google Cloud. Legacy integrations that still use keys create them on setup and rotation. The detection rule reports every key created. A key created by a person, for an account that holds broad roles or domain-wide delegation, or for an account that has not been used for months is the entry to read first.
Keeping it manageable
- Compare the caller with the account in
resource.labels.email_id: a person creating a key for a privileged service account is the case to confirm first. - Follow the key: entries of later calls authenticated with it in general carry its name in
protoPayload.authenticationInfo.serviceAccountKeyName(some services, App Engine and Compute Engine among them, do not log it); check where they come from (callerIp). Where the entry does not show the new key's ID, list the account's keys and match on the time the key became valid (validAfterTime). - Read failures too:
status.messagesaying key creation is not allowed means an organization policy blocked the attempt. - Check the organization policy history: a key created soon after
iam.disableServiceAccountKeyCreationwas lifted, or after a project was tagged as exempt from it, can be the guardrail being removed for this purpose.
Sample event
A Google Cloud Audit Logs record in the vendor’s format, with made-up values.
{
"protoPayload": {
"@type": "type.googleapis.com/google.cloud.audit.AuditLog",
"authenticationInfo": {
"principalEmail": "admin@corp.example.com"
},
"requestMetadata": {
"callerIp": "203.0.113.24",
"requestAttributes": {},
"destinationAttributes": {}
},
"serviceName": "iam.googleapis.com",
"methodName": "google.iam.admin.v1.CreateServiceAccountKey",
"resourceName": "projects/-/serviceAccounts/100000000000000000011",
"request": {
"@type": "type.googleapis.com/google.iam.admin.v1.CreateServiceAccountKeyRequest",
"name": "projects/-/serviceAccounts/report-exporter@corp-prod-01.iam.gserviceaccount.com",
"private_key_type": "TYPE_GOOGLE_CREDENTIALS_FILE"
},
"status": {}
},
"insertId": "1x2y3z4a5b6c",
"resource": {
"type": "service_account",
"labels": {
"email_id": "report-exporter@corp-prod-01.iam.gserviceaccount.com",
"project_id": "corp-prod-01",
"unique_id": "100000000000000000011"
}
},
"timestamp": "2026-11-18T09:30:12.345678Z",
"severity": "NOTICE",
"logName": "projects/corp-prod-01/logs/cloudaudit.googleapis.com%2Factivity",
"receiveTimestamp": "2026-11-18T09:30:13.012345678Z"
}Attacks this event reveals
Detection rules that read this event:
Detection logic (hypotheses that join this event with others) for:
References
- IAM audit logging (Google Cloud)
- Example logs for service accounts (Google Cloud)
- projects.serviceAccounts.keys.create, IAM API reference (Google Cloud)
- projects.serviceAccounts.keys (ServiceAccountKey), IAM API reference (Google Cloud)
- Create and delete service account keys (Google Cloud)
- Restricting service account usage (Google Cloud)
- AuditLog reference (Google Cloud)