1. Registry
  2. Packages
  3. Pulumi Cloud (Pulumi Service provider)
  4. API Docs
  5. getOrganizationRole
Viewing docs for Pulumi Cloud v1.5.0
published on Monday, Oct 19, 2026 by Pulumi
pulumiservice logo pulumiservice logo
Viewing docs for Pulumi Cloud v1.5.0
published on Monday, Oct 19, 2026 by Pulumi

    Looks up a role in a Pulumi Cloud organization by the name shown in the Pulumi Cloud console. Finds both built-in and custom roles. Use the returned roleId for inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId, instead of hardcoding the ID. Returns an error when no role has the given name.

    Example Usage

    Look up a role you defined

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PulumiService = Pulumi.PulumiService;
    
    return await Deployment.RunAsync(() => 
    {
        var ciDeployerRole = PulumiService.GetOrganizationRole.Invoke(new()
        {
            OrganizationName = "my-org",
            Name = "CI Deployer",
        });
    
        var platformTeamRole = new PulumiService.TeamRoleAssignment("platformTeamRole", new()
        {
            OrganizationName = "my-org",
            TeamName = "platform",
            RoleId = ciDeployerRole.Apply(getOrganizationRoleResult => getOrganizationRoleResult.RoleId),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-pulumiservice/sdk/go/pulumiservice"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ciDeployerRole := pulumiservice.GetOrganizationRoleOutput(ctx, pulumiservice.GetOrganizationRoleOutputArgs{
    			OrganizationName: pulumi.String("my-org"),
    			Name:             pulumi.String("CI Deployer"),
    		}, nil)
    		_, err := pulumiservice.NewTeamRoleAssignment(ctx, "platformTeamRole", &pulumiservice.TeamRoleAssignmentArgs{
    			OrganizationName: pulumi.String("my-org"),
    			TeamName:         pulumi.String("platform"),
    			RoleId:           ciDeployerRole.RoleId(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pulumiservice.PulumiserviceFunctions;
    import com.pulumi.pulumiservice.inputs.GetOrganizationRoleArgs;
    import com.pulumi.pulumiservice.TeamRoleAssignment;
    import com.pulumi.pulumiservice.TeamRoleAssignmentArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var ciDeployerRole = PulumiserviceFunctions.getOrganizationRole(GetOrganizationRoleArgs.builder()
                .organizationName("my-org")
                .name("CI Deployer")
                .build());
    
            var platformTeamRole = new TeamRoleAssignment("platformTeamRole", TeamRoleAssignmentArgs.builder()
                .organizationName("my-org")
                .teamName("platform")
                .roleId(ciDeployerRole.applyValue(_ciDeployerRole -> _ciDeployerRole.roleId()))
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as pulumiservice from "@pulumi/pulumiservice";
    
    const ciDeployerRole = pulumiservice.getOrganizationRoleOutput({
        organizationName: "my-org",
        name: "CI Deployer",
    });
    const platformTeamRole = new pulumiservice.TeamRoleAssignment("platformTeamRole", {
        organizationName: "my-org",
        teamName: "platform",
        roleId: ciDeployerRole.roleId,
    });
    
    import pulumi
    import pulumi_pulumiservice as pulumiservice
    
    ci_deployer_role = pulumiservice.get_organization_role_output(organization_name="my-org",
        name="CI Deployer")
    platform_team_role = pulumiservice.TeamRoleAssignment("platformTeamRole",
        organization_name="my-org",
        team_name="platform",
        role_id=ci_deployer_role.role_id)
    
    variables:
      ciDeployerRole:
        fn::invoke:
          function: pulumiservice:getOrganizationRole
          arguments:
            organizationName: my-org
            name: CI Deployer
    resources:
      platformTeamRole:
        type: pulumiservice:TeamRoleAssignment
        properties:
          organizationName: my-org
          teamName: platform
          roleId: ${ciDeployerRole.roleId}
    

    Look up a built-in role

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PulumiService = Pulumi.PulumiService;
    
    return await Deployment.RunAsync(() => 
    {
        var adminRole = PulumiService.GetOrganizationRole.Invoke(new()
        {
            OrganizationName = "my-org",
            Name = "Admin",
        });
    
        return new Dictionary<string, object?>
        {
            ["adminRoleId"] = adminRole.Apply(getOrganizationRoleResult => getOrganizationRoleResult.RoleId),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-pulumiservice/sdk/go/pulumiservice"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		adminRole := pulumiservice.GetOrganizationRoleOutput(ctx, pulumiservice.GetOrganizationRoleOutputArgs{
    			OrganizationName: pulumi.String("my-org"),
    			Name:             pulumi.String("Admin"),
    		}, nil)
    		ctx.Export("adminRoleId", adminRole.RoleId())
    		return nil
    	})
    }
    

    Example coming soon!

    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pulumiservice.PulumiserviceFunctions;
    import com.pulumi.pulumiservice.inputs.GetOrganizationRoleArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var adminRole = PulumiserviceFunctions.getOrganizationRole(GetOrganizationRoleArgs.builder()
                .organizationName("my-org")
                .name("Admin")
                .build());
    
            ctx.export("adminRoleId", adminRole.applyValue(_adminRole -> _adminRole.roleId()));
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as pulumiservice from "@pulumi/pulumiservice";
    
    const adminRole = pulumiservice.getOrganizationRoleOutput({
        organizationName: "my-org",
        name: "Admin",
    });
    export const adminRoleId = adminRole.roleId;
    
    import pulumi
    import pulumi_pulumiservice as pulumiservice
    
    admin_role = pulumiservice.get_organization_role_output(organization_name="my-org",
        name="Admin")
    pulumi.export("adminRoleId", admin_role.role_id)
    
    variables:
      adminRole:
        fn::invoke:
          function: pulumiservice:getOrganizationRole
          arguments:
            organizationName: my-org
            name: Admin
    outputs:
      adminRoleId: ${adminRole.roleId}
    

    Using getOrganizationRole

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getOrganizationRole(args: GetOrganizationRoleArgs, opts?: InvokeOptions): Promise<GetOrganizationRoleResult>
    function getOrganizationRoleOutput(args: GetOrganizationRoleOutputArgs, opts?: InvokeOutputOptions): Output<GetOrganizationRoleResult>
    def get_organization_role(name: Optional[str] = None,
                              organization_name: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetOrganizationRoleResult
    def get_organization_role_output(name: pulumi.Input[Optional[str]] = None,
                              organization_name: pulumi.Input[Optional[str]] = None,
                              opts: Optional[InvokeOutputOptions] = None) -> Output[GetOrganizationRoleResult]
    func LookupOrganizationRole(ctx *Context, args *LookupOrganizationRoleArgs, opts ...InvokeOption) (*LookupOrganizationRoleResult, error)
    func LookupOrganizationRoleOutput(ctx *Context, args *LookupOrganizationRoleOutputArgs, opts ...InvokeOption) LookupOrganizationRoleResultOutput

    > Note: This function is named LookupOrganizationRole in the Go SDK.

    public static class GetOrganizationRole 
    {
        public static Task<GetOrganizationRoleResult> InvokeAsync(GetOrganizationRoleArgs args, InvokeOptions? opts = null)
        public static Output<GetOrganizationRoleResult> Invoke(GetOrganizationRoleInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetOrganizationRoleResult> Invoke(GetOrganizationRoleInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetOrganizationRoleResult> getOrganizationRole(GetOrganizationRoleArgs args, InvokeOptions options)
    public static Output<GetOrganizationRoleResult> getOrganizationRole(GetOrganizationRoleArgs args, InvokeOptions options)
    public static Output<GetOrganizationRoleResult> getOrganizationRole(GetOrganizationRoleArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: pulumiservice:getOrganizationRole
      arguments:
        # arguments dictionary
    data "pulumiservice_get_organization_role" "name" {
        # arguments
    }

    The following arguments are supported:

    Name string
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    OrganizationName string
    The name of the Pulumi organization.
    Name string
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    OrganizationName string
    The name of the Pulumi organization.
    name string
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    organization_name string
    The name of the Pulumi organization.
    name String
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    organizationName String
    The name of the Pulumi organization.
    name string
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    organizationName string
    The name of the Pulumi organization.
    name str
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    organization_name str
    The name of the Pulumi organization.
    name String
    The role's name, as shown in the Pulumi Cloud console. The match is case-insensitive, as role names are unique within an organization regardless of case.
    organizationName String
    The name of the Pulumi organization.

    getOrganizationRole Result

    The following output properties are available:

    BuiltIn bool
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    Name string
    The role's name, as shown in the Pulumi Cloud console.
    RoleId string
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    Description string
    The role's description, if it has one.
    BuiltIn bool
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    Name string
    The role's name, as shown in the Pulumi Cloud console.
    RoleId string
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    Description string
    The role's description, if it has one.
    built_in bool
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    name string
    The role's name, as shown in the Pulumi Cloud console.
    role_id string
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    description string
    The role's description, if it has one.
    builtIn Boolean
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    name String
    The role's name, as shown in the Pulumi Cloud console.
    roleId String
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    description String
    The role's description, if it has one.
    builtIn boolean
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    name string
    The role's name, as shown in the Pulumi Cloud console.
    roleId string
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    description string
    The role's description, if it has one.
    built_in bool
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    name str
    The role's name, as shown in the Pulumi Cloud console.
    role_id str
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    description str
    The role's description, if it has one.
    builtIn Boolean
    Whether this is one of the roles every organization has (Admin, Member and Billing Manager), rather than a custom role.
    name String
    The role's name, as shown in the Pulumi Cloud console.
    roleId String
    The role's ID. Pass it to inputs that take a role ID, such as TeamRoleAssignment.roleId and OrganizationMember.roleId.
    description String
    The role's description, if it has one.

    Package Details

    Repository
    pulumiservice pulumi/pulumi-pulumiservice
    License
    Apache-2.0
    pulumiservice logo pulumiservice logo
    Viewing docs for Pulumi Cloud v1.5.0
    published on Monday, Oct 19, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial