{"record":{"id":"62819e87f74f37c8","repo":"pulumi/pulumi","slug":"exporting-audit-logs-requires-the-pulumi-cloud-bac","errorCode":null,"errorMessage":"exporting audit logs requires the Pulumi Cloud backend; run `pulumi login`","messagePattern":"exporting audit logs requires the Pulumi Cloud backend; run `pulumi login`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/org/org_audit_log_export.go","lineNumber":139,"sourceCode":"\treturn cmd\n}\n\n// defaultOrgAuditLogExportClientFactory is the production wiring: resolve the\n// cloud backend, pick the effective organization, and hand back the\n// underlying *client.Client.\nfunc defaultOrgAuditLogExportClientFactory(\n\tctx context.Context, orgFlag string,\n) (orgAuditLogExportClient, string, error) {\n\tws := pkgWorkspace.Instance\n\topts := display.Options{Color: cmdutil.GetGlobalColorization()}\n\n\tbe, err := cmdBackend.CurrentBackend(ctx, ws, cmdBackend.DefaultLoginManager, nil, opts)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tcloudBackend, ok := be.(httpstate.Backend)\n\tif !ok {\n\t\treturn nil, \"\", errors.New(\n\t\t\t\"exporting audit logs requires the Pulumi Cloud backend; run `pulumi login`\")\n\t}\n\n\tuserName, orgs, _, err := cloudBackend.CurrentUser()\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\torg := orgFlag\n\tif org == \"\" {\n\t\tdefaultOrg, err := cloudBackend.GetDefaultOrg(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\torg = defaultOrg\n\t}\n\tif org == \"\" {\n\t\torg = userName","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/org/org_audit_log_export.go#L121-L157","documentation":"Audit log export is a Pulumi Cloud-only feature. The command resolves the current backend and type-asserts it to the HTTP state (cloud) backend; any other backend (local, object-store) fails this assertion and gets this error.","triggerScenarios":"Running `pulumi org export-audit-logs` (or similar) while logged into a local or DIY backend instead of app.pulumi.com or a Pulumi Cloud endpoint.","commonSituations":"CI environments defaulting to a local backend; developers who forgot to `pulumi login` before running export in a fresh container.","solutions":["Run `pulumi login` against the Pulumi Cloud backend and retry","Verify with `pulumi whoami` that you're on the Pulumi Cloud backend","Ensure PULUMI_BACKEND_URL / credentials point to a cloud backend in CI"],"exampleFix":"// before\npulumi org export-audit-logs my-org --from 2024-01-01  # local backend\n// after\npulumi login\npulumi org export-audit-logs my-org --from 2024-01-01","handlingStrategy":"type-guard","validationCode":"pulumi whoami | grep -q pulumi.com || { echo \"audit log export needs Pulumi Cloud backend; run pulumi login\"; exit 1; }","typeGuard":"cloudBackend, ok := be.(httpstate.Backend)\nif !ok {\n\t// not on Pulumi Cloud backend\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"requires the Pulumi Cloud backend\") {\n\t// run pulumi login then retry\n}","preventionTips":["Ensure CI exports cloud credentials before audit export","Verify backend with `pulumi whoami` first"],"tags":["cli","audit-logs","backend"],"backgroundTag":"cloud-backend-required","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}