Guide · IAM Identity Center · Permission Sets

IAM Identity Center Permission Sets for MCP Servers — Policies, Provisioning, and Session Duration

An IAM Identity Center permission set is a named IAM policy template that becomes a role in each AWS account you assign it to. When you assign a user or group to an account with a permission set, IdC automatically creates (and maintains) an IAM role in that account. Changes to the permission set's policies propagate to all assigned accounts via ProvisionPermissionSet. This guide covers the full permission set lifecycle: creation, attaching policies, the customer-managed policy reference feature, permissions boundaries, provisioning, and status polling — all via the @aws-sdk/client-sso-admin SDK.

TL;DR

Create a permission set with CreatePermissionSetCommand, attach up to 10 AWS managed policies with AttachManagedPolicyToPermissionSetCommand, add one inline policy with PutInlinePolicyToPermissionSetCommand, and reference customer-managed policies by name (not ARN) with AttachCustomerManagedPolicyReferenceToPermissionSetCommand. After any policy change, call ProvisionPermissionSetCommand and poll DescribePermissionSetProvisioningStatusCommand for SUCCEEDED.

What a permission set becomes in a target account

When you create an account assignment connecting a permission set to an AWS account, IAM Identity Center creates an IAM role in that account with:

You cannot directly edit these roles in the target accounts — changes made outside of IdC are overwritten the next time the permission set is provisioned. Treat the permission set as the source of truth.

Creating a permission set

import {
  SSOAdminClient,
  ListInstancesCommand,
  CreatePermissionSetCommand,
  DescribePermissionSetCommand,
} from "@aws-sdk/client-sso-admin";

const ssoAdmin = new SSOAdminClient({ region: "us-east-1" });

// Get the instance ARN first (do this once and cache it)
const { instances } = await ssoAdmin.send(new ListInstancesCommand({}));
const INSTANCE_ARN = instances![0].instanceArn!;

// Create the permission set
const ps = await ssoAdmin.send(new CreatePermissionSetCommand({
  InstanceArn:     INSTANCE_ARN,
  Name:            "MCPServerDeveloper",    // 1-32 chars, alphanumeric + underscore
  Description:     "Full access to MCP server infrastructure in dev/staging accounts",
  SessionDuration: "PT8H",                  // ISO 8601: PT1H to PT12H; default PT1H
  Tags: [
    { Key: "Team",        Value: "platform" },
    { Key: "CostCenter",  Value: "engineering" },
  ],
}));

console.log("Permission set ARN:", ps.permissionSet?.permissionSetArn);
// arn:aws:sso:::permissionSet/ssoins-0a1b2c3d4e5f6a7b/ps-aabbccdd11223344

The SessionDuration controls how long temporary credentials issued for this permission set remain valid. The minimum is PT1H; the maximum is PT12H. For developer access to staging accounts where longer sessions reduce re-authentication friction, PT8H is common. For production accounts with privileged access, PT1H limits blast radius if a session token is stolen.

The optional RelayStateType field lets you specify a URL to redirect users to after they sign in through the portal — useful for linking directly to the AWS console service page most relevant to this permission set's audience.

Attaching AWS managed policies

AWS managed policies are referenced by ARN. You can attach up to 10 per permission set:

import { AttachManagedPolicyToPermissionSetCommand } from "@aws-sdk/client-sso-admin";

const PS_ARN = ps.permissionSet!.permissionSetArn!;

// Attach ReadOnlyAccess for a read-only permission set
await ssoAdmin.send(new AttachManagedPolicyToPermissionSetCommand({
  InstanceArn:       INSTANCE_ARN,
  PermissionSetArn:  PS_ARN,
  ManagedPolicyArn:  "arn:aws:iam::aws:policy/ReadOnlyAccess",
}));

// Add PowerUserAccess for a developer permission set
await ssoAdmin.send(new AttachManagedPolicyToPermissionSetCommand({
  InstanceArn:       INSTANCE_ARN,
  PermissionSetArn:  PS_ARN,
  ManagedPolicyArn:  "arn:aws:iam::aws:policy/PowerUserAccess",
}));

To list currently attached managed policies:

import { ListManagedPoliciesInPermissionSetCommand } from "@aws-sdk/client-sso-admin";

const attached = await ssoAdmin.send(new ListManagedPoliciesInPermissionSetCommand({
  InstanceArn:      INSTANCE_ARN,
  PermissionSetArn: PS_ARN,
}));
for (const policy of attached.AttachedManagedPolicies ?? []) {
  console.log(policy.Name, policy.Arn);
}

Adding an inline policy

Each permission set supports exactly one inline policy. Calling PutInlinePolicyToPermissionSet again replaces the existing one — there is no append operation. Use this for account-specific overrides that do not belong in a managed policy:

import { PutInlinePolicyToPermissionSetCommand } from "@aws-sdk/client-sso-admin";

const inlinePolicy = {
  Version: "2012-10-17",
  Statement: [
    {
      Sid: "AllowMCPServerDynamoDB",
      Effect: "Allow",
      Action: [
        "dynamodb:GetItem",
        "dynamodb:PutItem",
        "dynamodb:UpdateItem",
        "dynamodb:DeleteItem",
        "dynamodb:Query",
        "dynamodb:Scan",
      ],
      Resource: [
        "arn:aws:dynamodb:us-east-1:*:table/mcp-*",
        "arn:aws:dynamodb:us-east-1:*:table/mcp-*/index/*",
      ],
    },
    {
      Sid: "AllowS3MCPBucket",
      Effect: "Allow",
      Action: ["s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:ListBucket"],
      Resource: [
        "arn:aws:s3:::mcp-artifacts-*",
        "arn:aws:s3:::mcp-artifacts-*/*",
      ],
    },
  ],
};

await ssoAdmin.send(new PutInlinePolicyToPermissionSetCommand({
  InstanceArn:       INSTANCE_ARN,
  PermissionSetArn:  PS_ARN,
  InlinePolicy:      JSON.stringify(inlinePolicy),
}));

Customer-managed policy references

Customer-managed policy references let you attach a policy by name rather than ARN. This is a critical distinction: the policy must exist in every target account under the same name and path before you provision the permission set to that account. If the policy doesn't exist in a target account, provisioning fails for that account with error INTERNAL_FAILURE.

import { AttachCustomerManagedPolicyReferenceToPermissionSetCommand } from "@aws-sdk/client-sso-admin";

// The policy must exist as "MCPServerPolicy" at path "/" in every target account
await ssoAdmin.send(new AttachCustomerManagedPolicyReferenceToPermissionSetCommand({
  InstanceArn:      INSTANCE_ARN,
  PermissionSetArn: PS_ARN,
  CustomerManagedPolicyReference: {
    Name: "MCPServerPolicy",    // must match exactly in every target account
    Path: "/",                  // defaults to "/"; set to match your policy path
  },
}));

The workflow for customer-managed policy references in a multi-account setup:

  1. Use CloudFormation StackSets (or CDK pipelines) to deploy the IAM policy to every member account under the same name and path.
  2. Then attach the customer-managed policy reference to the permission set.
  3. Then provision the permission set to those accounts.

This pattern lets you embed account-specific logic (using the policy's condition keys or resource ARNs) in a per-account managed policy, while the permission set remains the same across accounts.

Permissions boundaries

Add a permissions boundary to cap the maximum effective permissions of any role created from this permission set, regardless of what policies are attached:

import { PutPermissionsBoundaryToPermissionSetCommand } from "@aws-sdk/client-sso-admin";

// Use an AWS managed policy as the boundary
await ssoAdmin.send(new PutPermissionsBoundaryToPermissionSetCommand({
  InstanceArn:      INSTANCE_ARN,
  PermissionSetArn: PS_ARN,
  PermissionsBoundary: {
    ManagedPolicyArn: "arn:aws:iam::aws:policy/PowerUserAccess",
  },
}));

// Or a customer-managed policy by name (same pre-deployment requirement as above)
await ssoAdmin.send(new PutPermissionsBoundaryToPermissionSetCommand({
  InstanceArn:      INSTANCE_ARN,
  PermissionSetArn: PS_ARN,
  PermissionsBoundary: {
    CustomerManagedPolicyReference: {
      Name: "MCPServerBoundary",
      Path: "/",
    },
  },
}));

Provisioning a permission set to accounts

ProvisionPermissionSetCommand is the operation that pushes the current permission set configuration to target accounts. It is asynchronous — the response contains a request ID, not the final status. You must poll DescribePermissionSetProvisioningStatusCommand to know when it completes.

import {
  ProvisionPermissionSetCommand,
  DescribePermissionSetProvisioningStatusCommand,
  ProvisioningStatus,
} from "@aws-sdk/client-sso-admin";

// Provision to ALL accounts that have an assignment for this permission set
const provisionResp = await ssoAdmin.send(new ProvisionPermissionSetCommand({
  InstanceArn:      INSTANCE_ARN,
  PermissionSetArn: PS_ARN,
  TargetType:       "ALL_PROVISIONED_ACCOUNTS",
  // TargetType: "AWS_ACCOUNT", TargetId: "123456789012"  // for a single account
}));

const requestId = provisionResp.PermissionSetProvisioningStatus?.RequestId!;
console.log("Provisioning request ID:", requestId);

// Poll until terminal status
async function waitForProvisioning(requestId: string): Promise {
  while (true) {
    await new Promise(r => setTimeout(r, 3000));  // 3s between polls
    const status = await ssoAdmin.send(new DescribePermissionSetProvisioningStatusCommand({
      InstanceArn:                      INSTANCE_ARN,
      ProvisionPermissionSetRequestId:  requestId,
    }));

    const state = status.PermissionSetProvisioningStatus?.Status;
    console.log("Status:", state);

    if (state === "SUCCEEDED") return "SUCCEEDED";
    if (state === "FAILED") {
      const reason = status.PermissionSetProvisioningStatus?.FailureReason;
      throw new Error(`Provisioning failed: ${reason}`);
    }
    // IN_PROGRESS — keep polling
  }
}

await waitForProvisioning(requestId);

Common FailureReason values on FAILED status:

Provisioning to ALL_PROVISIONED_ACCOUNTS is eventually consistent — if you have 50 assigned accounts, the operation fans out in parallel and each account reports its own status. The top-level status returns SUCCEEDED when all account-level operations complete. If any single account fails, the top-level status is FAILED.

Listing and querying permission sets

import {
  ListPermissionSetsCommand,
  ListAccountsForProvisionedPermissionSetCommand,
} from "@aws-sdk/client-sso-admin";

// List all permission sets in the instance
for (let nextToken: string | undefined = undefined;;) {
  const page = await ssoAdmin.send(new ListPermissionSetsCommand({
    InstanceArn: INSTANCE_ARN,
    NextToken:   nextToken,
  }));
  for (const arn of page.PermissionSets ?? []) {
    const desc = await ssoAdmin.send(new DescribePermissionSetCommand({
      InstanceArn:      INSTANCE_ARN,
      PermissionSetArn: arn,
    }));
    console.log(desc.PermissionSet?.Name, desc.PermissionSet?.SessionDuration);
  }
  if (!page.NextToken) break;
  nextToken = page.NextToken;
}

// List which accounts have this permission set provisioned
const accounts = await ssoAdmin.send(new ListAccountsForProvisionedPermissionSetCommand({
  InstanceArn:      INSTANCE_ARN,
  PermissionSetArn: PS_ARN,
}));
console.log("Provisioned in accounts:", accounts.AccountIds);

Permission set lifecycle and updates

The workflow for updating an existing permission set is: modify policies → provision to accounts. There is no staging or preview — changes take effect in the target accounts immediately after a successful provisioning run. For this reason, treat permission sets as infrastructure-as-code. Store each permission set's policy configuration in a Git repository and run ProvisionPermissionSet from a CI pipeline whenever the configuration changes. Use the ListAccountsForProvisionedPermissionSetCommand to build an audit log of which accounts received each version.

To verify provisioning succeeded in a specific account, combine ListAccountAssignments (to confirm the assignment exists) with ListPermissionSets in the target account (requires sso-admin:ListPermissionSets in the target account, only available via cross-account role, not directly via IdC API). The simpler audit is to check CloudTrail in the target account for eventName = AttachRolePolicy from sso.amazonaws.com after the provisioning timestamp.