Skip to content

New-LMAPIToken

Syntax

Id

Terminal window
New-LMAPIToken -Id <String[]> [-Note <String>] [-CreateDisabled] [-Type <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]

Username

Terminal window
New-LMAPIToken -Username <String> [-Note <String>] [-CreateDisabled] [-Type <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]

Description

The New-LMAPIToken function creates a new API token for a specified user in LogicMonitor.

Examples

Example 1

Terminal window
#Create a token by user ID
New-LMAPIToken -Id "12345" -Note "API Token for automation"

Example 2

Terminal window
#Create a token by username
New-LMAPIToken -Username "john.doe" -Type "Bearer" -CreateDisabled

Parameters

-Id

The ID of the user to create the token for. Required for Id parameter set.

Type: String[]
Parameter Sets: Id
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Username

The username to create the token for. Required for Username parameter set.

Type: String
Parameter Sets: Username
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Note

A note describing the purpose of the API token.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CreateDisabled

Switch to create the token in a disabled state.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Type

The type of API token to create. Valid values are “LMv1” and “Bearer”. Defaults to “LMv1”.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: LMv1
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Fill ProgressAction Description

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None. You cannot pipe objects to this command.

Outputs

Returns LogicMonitor.APIToken object.

Notes

You must run Connect-LMAccount before running this command.