Skip to content

Adds Intelligence Pack functions #1241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
<Reference Include="Microsoft.Azure.Management.Authorization">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.OperationalInsights">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.9.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Gallery">
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.OperationalInsights">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.10.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
Expand Down Expand Up @@ -185,6 +185,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.OperationalInsights.Test.WorkspaceTests\TestWorkspaceCreateUpdateDelete.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.OperationalInsights.Test.WorkspaceTests\TestWorkspaceEnableDisableListIntelligencePacks.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function Get-ProviderLocation()
{
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
{
$namespace = "OperationalInsights"
$type = workspaces
$namespace = "Microsoft.OperationalInsights"
$type = "workspaces"
$location = Get-AzureRmResourceProvider -ProviderNamespace $namespace | where {$_.ResourceTypes[0].ResourceTypeName -eq $type}

if ($location -eq $null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public void TestWorkspaceCreateUpdateDelete()
public void TestWorkspaceActions()
{
RunPowerShellTest("Test-WorkspaceActions");
}
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestWorkspaceEnableDisableListIntelligencePacks()
{
RunPowerShellTest("Test-WorkspaceEnableDisableListIntelligencePacks");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,71 @@ function Test-WorkspaceActions
Assert-NotNull $usages[0].NextResetTime
Assert-AreEqual "Bytes" $usages[0].Unit
Assert-AreEqual ([Timespan]::FromDays(1)) $usages[0].QuotaPeriod
}

<#
.SYNOPSIS
Enable, disable, and list intelligence packs and verify the results
#>
function Test-WorkspaceEnableDisableListIntelligencePacks
{

$wsname = Get-ResourceName
$rgname = Get-ResourceGroupName
$wslocation = Get-ProviderLocation

New-AzureRmResourceGroup -Name $rgname -Location $wslocation -Force

# Create and get a workspace
$workspace = New-AzureRmOperationalInsightsWorkspace -ResourceGroupName $rgname -Name $wsname -Location $wslocation -Sku free -Tags @{"tag1" = "val1"} -Force
Assert-AreEqual $rgname $workspace.ResourceGroupName
Assert-AreEqual $wsname $workspace.Name
Assert-AreEqual $wslocation $workspace.Location
Assert-AreEqual "free" $workspace.Sku
Assert-NotNull $workspace.ResourceId
Assert-AreEqual 1 $workspace.Tags.Count
Assert-NotNull $workspace.CustomerId
Assert-NotNull $workspace.PortalUrl

# Enable intelligence packs
Set-AzureRmOperationalInsightsIntelligencePack -ResourceGroupName $rgname -WorkspaceName $wsname -IntelligencePackName "ChangeTracking" -Enabled $true
Set-AzureRmOperationalInsightsIntelligencePack -ResourceGroupName $rgname -WorkspaceName $wsname -IntelligencePackName "SiteRecovery" -Enabled $true

# List to verify that the IP's have been enabled
$ipList = Get-AzureRmOperationalInsightsIntelligencePacks -ResourceGroupName $rgname -WorkspaceName $wsname
Foreach ($ip in $ipList)
{
if (($ip.Name -eq "ChangeTracking") -or ($ip.Name -eq "SiteRecovery") -or ($ip.Name -eq "LogManagement"))
{
Assert-True $ip.Enabled
}
else
{
Assert-False $ip.Enabled
}
}

# Disable intelligence packs
Set-AzureRmOperationalInsightsIntelligencePack -ResourceGroupName $rgname -WorkspaceName $wsname -IntelligencePackName "ChangeTracking" -Enabled $false
Set-AzureRmOperationalInsightsIntelligencePack -ResourceGroupName $rgname -WorkspaceName $wsname -IntelligencePackName "SiteRecovery" -Enabled $false

# List to verify that the IP's have been disabled
$ipList = Get-AzureRmOperationalInsightsIntelligencePacks -ResourceGroupName $rgname -WorkspaceName $wsname
Foreach ($ip in $ipList)
{
if ($ip.Name -eq "LogManagement")
{
Assert-True $ip.Enabled
}
else
{
Assert-False $ip.Enabled
}
}

# Delete the original workspace via piping
$workspace | Remove-AzureRmOperationalInsightsWorkspace -Force
$workspaces = Get-AzureRmOperationalInsightsWorkspace -ResourceGroupName $rgname
Assert-AreEqual 0 $workspaces.Count
Assert-ThrowsContains { Get-AzureRmOperationalInsightsWorkspace -ResourceGroupName $rgname -Name wsname } "ResourceNotFound"
}
Loading