This is the new CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.
AWS::ServiceCatalog::PortfolioPrincipalAssociation
Associates the Amazon Resource Name (ARN) of the specified principal with the specified portfolio.
Syntax
To declare this entity in your CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::ServiceCatalog::PortfolioPrincipalAssociation", "Properties" : { "AcceptLanguage" :String, "PortfolioId" :String, "PrincipalARN" :String, "PrincipalType" :String} }
YAML
Type: AWS::ServiceCatalog::PortfolioPrincipalAssociation Properties: AcceptLanguage:StringPortfolioId:StringPrincipalARN:StringPrincipalType:String
Properties
AcceptLanguage-
The language code.
-
jp- Japanese -
zh- Chinese
Required: No
Type: String
Maximum:
100Update requires: Replacement
-
PortfolioId-
The portfolio identifier.
Required: No
Type: String
Pattern:
^[a-zA-Z0-9_\-]*Minimum:
1Maximum:
100Update requires: Replacement
PrincipalARN-
The ARN of the principal (IAM user, role, or group). The ARN format depends on the value of
PrincipalType, as follows:-
IAM- A full ARN, in the formatarn:partition:iam::account-id:resource-type/resource-id, for examplearn:aws:iam::444455556666:role/Admin. -
IAM_PATTERN- An ARN without the account ID, in the formatarn:partition:iam:::resource-type/resource-id, for examplearn:aws:iam:::role/Admin.
With
IAM_PATTERN, the path and name in the resource ID can contain the wildcard characters*, which matches any number of characters, and?, which matches zero or one character, for examplearn:aws:iam:::role/MyTeam-*. Wildcards can't replace the resource type (user,group, orrole). You can associate anIAM_PATTERNARN even if no principal with that name exists.Required: No
Type: String
Pattern:
arn:(aws|aws-cn|aws-us-gov):iam::[0-9]*:(role|user|group)\/.*Update requires: Replacement
-
PrincipalType-
The principal type. Specify
IAMto associate a principal by its full ARN, orIAM_PATTERNto associate principals by an ARN that has no account ID and can contain wildcard characters. You can associate up to 10 principals of typeIAM_PATTERNwith a portfolio. For the ARN formats, seePrincipalARN.Required: Yes
Type: String
Allowed values:
IAM | IAM_PATTERNUpdate requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns a unique identifier for the association.
For more information about using the Ref function, see Ref.
Examples
Example - Associate an IAM role with a portfolio
The following example gives the IAM role MyRole in the current account access to the
portfolio MyPortfolio, which is declared elsewhere in the same template.
JSON
{ "MyPrincipalAssociation": { "Type": "AWS::ServiceCatalog::PortfolioPrincipalAssociation", "Properties": { "PortfolioId": { "Ref": "MyPortfolio" }, "PrincipalType": "IAM", "PrincipalARN": { "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/MyRole" } } } }
YAML
MyPrincipalAssociation: Type: AWS::ServiceCatalog::PortfolioPrincipalAssociation Properties: PortfolioId: !Ref MyPortfolio PrincipalType: IAM PrincipalARN: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/MyRole
Example - Associate IAM roles by name pattern
The following example gives the IAM roles that have the default path (/) and whose names
start with MyTeam- access to the portfolio. With IAM_PATTERN, the ARN has no
account ID and can contain wildcard characters. AWS Service Catalog matches the pattern against both
the path and the name of a role. For example, this pattern doesn't match a role named
MyTeam-Dev that has the path /teams/. To include roles under other paths, also
associate a pattern such as arn:aws:iam:::role/*/MyTeam-*.
JSON
{ "MyPatternAssociation": { "Type": "AWS::ServiceCatalog::PortfolioPrincipalAssociation", "Properties": { "PortfolioId": { "Ref": "MyPortfolio" }, "PrincipalType": "IAM_PATTERN", "PrincipalARN": { "Fn::Sub": "arn:${AWS::Partition}:iam:::role/MyTeam-*" } } } }
YAML
MyPatternAssociation: Type: AWS::ServiceCatalog::PortfolioPrincipalAssociation Properties: PortfolioId: !Ref MyPortfolio PrincipalType: IAM_PATTERN PrincipalARN: !Sub arn:${AWS::Partition}:iam:::role/MyTeam-*
See also
-
AssociatePrincipalWithPortfolio in the AWS Service Catalog API Reference