New-AzOperationalInsightsWorkspace

Creates a workspace.

Syntax

New-AzOperationalInsightsWorkspace
   [-ResourceGroupName] <String>
   [-Name] <String>
   [-Location] <String>
   [[-Sku] <String>]
   [[-CustomerId] <Guid>]
   [[-Tag] <Hashtable>]
   [[-RetentionInDays] <Int32>]
   [-Force]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzOperationalInsightsWorkspace cmdlet creates a workspace in the specified resource group and location.

Examples

Example 1: Create a workspace by name

PS C:\>New-AzOperationalInsightsWorkspace -ResourceGroupName "ContosoResourceGroup" -Name "MyWorkspace" -Location "East US" -Sku "Standard"

This command creates a standard SKU workspace named MyWorkspace in the resource group named ContosoResourceGroup.

Example 2: Create a workspace and link it to an existing account

PS C:\>$OILinkTargets = Get-AzOperationalInsightsLinkTargets

PS C:\>$OILinkTargets[0] | New-AzOperationalInsightsWorkspace -ResourceGroupName "ContosoResourceGroup" -Name "MyWorkspace" -Sku "Standard"

The first command uses the Get-AzOperationalInsightsLinkTargets cmdlet to get Operational Insights account link targets, and then stores them in the $OILinkTargets variable. The second command passes the first account link target in $OILinkTargets to the New-AzOperationalInsightsWorkspace cmdlet by using the pipeline operator. The command creates a standard SKU workspace named MyWorkspace that is linked to the first Operational Insights account in $OILinkTargets.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-CustomerId

Specifies the account to which this workspace will be linked. The Get-AzOperationalInsightsLinkTargets cmdlet can also be used to list the potential accounts.

Type:System.Nullable`1[System.Guid]
Position:4
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Location

Specifies the location in which to create the workspace, for example, East US or West Europe.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the workspace.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of an Azure resource group. The workspace is created in this resource group.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-RetentionInDays

The workspace data retention in days. 730 days is the maximum allowed for all other Skus

Type:System.Nullable`1[System.Int32]
Position:6
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Sku

Specifies the service tier of the workspace. For more information regarding which value to use please check https://docs.microsoft.com/en-us/azure/azure-monitor/platform/manage-cost-storage#legacy-pricing-tiers. Valid values are:

  • free
  • pergb2018
  • pernode
  • premium
  • standalone
  • standard
Type:String
Accepted values:free, pergb2018, pernode, premium, standalone, standard
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Tag

The resource tags for the workspace.

Type:Hashtable
Position:5
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

Hashtable

System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

Outputs

PSWorkspace

Notes

A new pricing model has been released. If you are a CSP that means that you have to use "standalone" for the sku. Behind the scenes, the sku will be changed to pergb2018. For more information, please see the following: https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-usage-and-estimated-costs#new-pricing-model