Create log analytics work space

Login-AzureRmAccount
Set-AzureRmContext -SubscriptionId "your subcription id"
$ResourceGroupName='test-rg'
$WorkspaceName='tets-ws'
$Location='Southeast Asia'
$ws=Get-AzureRmOperationalInsightsWorkspace -Name $WorkspaceName -ResourceGroupName $ResourceGroupName -ErrorAction Ignore
if(($ws | Measure-Object).Count -eq 0)
{
    $ws = New-AzureRmOperationalInsightsWorkspace -Location $location -Name $WorkspaceName -sku $LogAnalytcisSKU -ResourceGroupName $ResourceGroupName
}

Comments