1. Packages
  2. Newrelic Provider
  3. API Docs
  4. getAccount
New Relic v5.58.2 published on Wednesday, Jan 7, 2026 by Pulumi
newrelic logo
New Relic v5.58.2 published on Wednesday, Jan 7, 2026 by Pulumi

    This data source allows you to retrieve information about a specific account in New Relic.

    Overview

    You can locate accounts using either their account_id or name. However, only one of these attributes can be specified at a time. If neither attribute is provided, the provider’s default account_id will be used.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const example = newrelic.getAccount({
        name: "Test Account",
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    example = newrelic.get_account(name="Test Account")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := newrelic.GetAccount(ctx, &newrelic.GetAccountArgs{
    			Name: pulumi.StringRef("Test Account"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var example = NewRelic.GetAccount.Invoke(new()
        {
            Name = "Test Account",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetAccountArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 example = NewrelicFunctions.getAccount(GetAccountArgs.builder()
                .name("Test Account")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: newrelic:getAccount
          arguments:
            name: Test Account
    

    Using getAccount

    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 getAccount(args: GetAccountArgs, opts?: InvokeOptions): Promise<GetAccountResult>
    function getAccountOutput(args: GetAccountOutputArgs, opts?: InvokeOptions): Output<GetAccountResult>
    def get_account(account_id: Optional[str] = None,
                    name: Optional[str] = None,
                    scope: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetAccountResult
    def get_account_output(account_id: Optional[pulumi.Input[str]] = None,
                    name: Optional[pulumi.Input[str]] = None,
                    scope: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetAccountResult]
    func GetAccount(ctx *Context, args *GetAccountArgs, opts ...InvokeOption) (*GetAccountResult, error)
    func GetAccountOutput(ctx *Context, args *GetAccountOutputArgs, opts ...InvokeOption) GetAccountResultOutput

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

    public static class GetAccount 
    {
        public static Task<GetAccountResult> InvokeAsync(GetAccountArgs args, InvokeOptions? opts = null)
        public static Output<GetAccountResult> Invoke(GetAccountInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAccountResult> getAccount(GetAccountArgs args, InvokeOptions options)
    public static Output<GetAccountResult> getAccount(GetAccountArgs args, InvokeOptions options)
    
    fn::invoke:
      function: newrelic:index/getAccount:getAccount
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AccountId string
    The unique identifier of the account in New Relic. This must be an integer.
    Name string
    The name of the account in New Relic. This must be a string.
    Scope string
    AccountId string
    The unique identifier of the account in New Relic. This must be an integer.
    Name string
    The name of the account in New Relic. This must be a string.
    Scope string
    accountId String
    The unique identifier of the account in New Relic. This must be an integer.
    name String
    The name of the account in New Relic. This must be a string.
    scope String
    accountId string
    The unique identifier of the account in New Relic. This must be an integer.
    name string
    The name of the account in New Relic. This must be a string.
    scope string
    account_id str
    The unique identifier of the account in New Relic. This must be an integer.
    name str
    The name of the account in New Relic. This must be a string.
    scope str
    accountId String
    The unique identifier of the account in New Relic. This must be an integer.
    name String
    The name of the account in New Relic. This must be a string.
    scope String

    getAccount Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Region string
    AccountId string
    Name string
    Scope string
    Id string
    The provider-assigned unique ID for this managed resource.
    Region string
    AccountId string
    Name string
    Scope string
    id String
    The provider-assigned unique ID for this managed resource.
    region String
    accountId String
    name String
    scope String
    id string
    The provider-assigned unique ID for this managed resource.
    region string
    accountId string
    name string
    scope string
    id str
    The provider-assigned unique ID for this managed resource.
    region str
    account_id str
    name str
    scope str
    id String
    The provider-assigned unique ID for this managed resource.
    region String
    accountId String
    name String
    scope String

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.58.2 published on Wednesday, Jan 7, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate