Skip to content

create_account_assignment async

create_account_assignment(
    instance_arn: InstanceArn,
    target_id: TargetId,
    target_type: TargetType,
    permission_set_arn: PermissionSetArn,
    principal_type: PrincipalType,
    principal_id: PrincipalId,
    *,
    config_overrides: Optional[AsyncSSOAdminClientConfig] = None,
) -> CreateAccountAssignmentResponse

Assigns access to a principal for a specified Amazon Web Services account using a specified permission set.

The term principal here refers to a user or group that is defined in IAM Identity Center.

As part of a successful CreateAccountAssignment call, the specified permission set will automatically be provisioned to the account in the form of an IAM policy. That policy is attached to the IAM role created in IAM Identity Center. If the permission set is subsequently updated, the corresponding IAM policies attached to roles in your accounts will not be updated automatically. In this case, you must call ProvisionPermissionSet to make these updates.

After a successful response, call DescribeAccountAssignmentCreationStatus to describe the status of an assignment creation request.

Parameters:

  • instance_arn (InstanceArn) –

    The ARN of the IAM Identity Center instance under which the operation will be executed. For more information about ARNs, see Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces in the Amazon Web Services General Reference.

  • target_id (TargetId) –

    TargetID is an Amazon Web Services account identifier, (For example, 123456789012).

  • target_type (TargetType) –

    The entity type for which the assignment will be created.

  • permission_set_arn (PermissionSetArn) –

    The ARN of the permission set that the admin wants to grant the principal access to.

  • principal_type (PrincipalType) –

    The entity type for which the assignment will be created.

  • principal_id (PrincipalId) –

    An identifier for an object in IAM Identity Center, such as a user or group. PrincipalIds are GUIDs (For example, f81d4fae-7dec-11d0-a765-00a0c91e6bf6). For more information about PrincipalIds in IAM Identity Center, see the IAM Identity Center Identity Store API Reference.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    Occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.

  • InternalServerException –

    The request processing has failed because of an unknown error, exception, or failure with an internal server.

  • ResourceNotFoundException –

    Indicates that a requested resource is not found.

  • ServiceQuotaExceededException –

    Indicates that the principal has crossed the permitted number of resources that can be created.

  • ThrottlingException –

    Indicates that the principal has crossed the throttling limits of the API operations.

  • ValidationException –

    The request failed because it contains a syntax error.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sso_admin/_services/async_sso_admin.py
async def create_account_assignment(
    self,
    instance_arn: "capo_sso_admin.types.instance_arn.InstanceArn",
    target_id: "capo_sso_admin.types.target_id.TargetId",
    target_type: "capo_sso_admin.types.target_type.TargetType",
    permission_set_arn: "capo_sso_admin.types.permission_set_arn.PermissionSetArn",
    principal_type: "capo_sso_admin.types.principal_type.PrincipalType",
    principal_id: "capo_sso_admin.types.principal_id.PrincipalId",
    *,
    config_overrides: Optional[AsyncSSOAdminClientConfig] = None,
) -> "capo_sso_admin.types.create_account_assignment_response.CreateAccountAssignmentResponse":
    """<p>Assigns access to a principal for a specified Amazon Web Services account using a specified permission set.</p> <note> <p>The term <i>principal</i> here refers to a user or group that is defined in IAM Identity Center.</p> </note> <note> <p>As part of a successful <code>CreateAccountAssignment</code> call, the specified permission set will automatically be provisioned to the account in the form of an IAM policy. That policy is attached to the IAM role created in IAM Identity Center. If the permission set is subsequently updated, the corresponding IAM policies attached to roles in your accounts will not be updated automatically. In this case, you must call <code> <a>ProvisionPermissionSet</a> </code> to make these updates.</p> </note> <note> <p> After a successful response, call <code>DescribeAccountAssignmentCreationStatus</code> to describe the status of an assignment creation request. </p> </note>

    Args:
        instance_arn: <p>The ARN of the IAM Identity Center instance under which the operation will be executed. For more information about ARNs, see <a href="/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces</a> in the <i>Amazon Web Services General Reference</i>.</p>
        target_id: <p>TargetID is an Amazon Web Services account identifier, (For example, 123456789012).</p>
        target_type: <p>The entity type for which the assignment will be created.</p>
        permission_set_arn: <p>The ARN of the permission set that the admin wants to grant the principal access to.</p>
        principal_type: <p>The entity type for which the assignment will be created.</p>
        principal_id: <p>An identifier for an object in IAM Identity Center, such as a user or group. PrincipalIds are GUIDs (For example, f81d4fae-7dec-11d0-a765-00a0c91e6bf6). For more information about PrincipalIds in IAM Identity Center, see the <a href="/singlesignon/latest/IdentityStoreAPIReference/welcome.html">IAM Identity Center Identity Store API Reference</a>.</p>

    Raises:
        capo_sso_admin.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_sso_admin.errors.conflict_exception.ConflictException: <p>Occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.</p>
        capo_sso_admin.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception, or failure with an internal server.</p>
        capo_sso_admin.errors.resource_not_found_exception.ResourceNotFoundException: <p>Indicates that a requested resource is not found.</p>
        capo_sso_admin.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Indicates that the principal has crossed the permitted number of resources that can be created.</p>
        capo_sso_admin.errors.throttling_exception.ThrottlingException: <p>Indicates that the principal has crossed the throttling limits of the API operations.</p>
        capo_sso_admin.errors.validation_exception.ValidationException: <p>The request failed because it contains a syntax error.</p>
        capo_sso_admin.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sso_admin.types.create_account_assignment_request.CreateAccountAssignmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_sso_admin.types.create_account_assignment_response.CreateAccountAssignmentResponse"
    ]:
        import capo_sso_admin._operations.swb_external_service.create_account_assignment

        (
            output,
            http_response,
        ) = await capo_sso_admin._operations.swb_external_service.create_account_assignment.async_create_account_assignment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAccountAssignment")
    )
    input_: capo_sso_admin.types.create_account_assignment_request.CreateAccountAssignmentRequest = {
        "instance_arn": instance_arn,
        "target_id": target_id,
        "target_type": target_type,
        "permission_set_arn": permission_set_arn,
        "principal_type": principal_type,
        "principal_id": principal_id,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output