Skip to content

Add ComputerGroups support to Azure.OperationalInsights cmdlets #2201

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 3 commits into from
May 12, 2016
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 @@ -58,7 +58,7 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.OperationalInsights, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.12.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.13.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Get and update search results
#>
function Test-SearchGetSearchResultsAndUpdate
{
$rgname = "OI-Default-East-US"
$wsname = "rasha"
$rgname = "mms-eus"
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"

$top = 25
$top = 5

$searchResult = Get-AzureRmOperationalInsightsSearchResults -ResourceGroupName $rgname -WorkspaceName $wsname -Top $top -Query "*"

Expand All @@ -45,8 +45,8 @@ Get schemas for a given workspace
#>
function Test-SearchGetSchema
{
$rgname = "mms-eus"
$wsname = "workspace-861bd466-5400-44be-9552-5ba40823c3aa"
$rgname = "mms-eus"
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"

$schema = Get-AzureRmOperationalInsightsSchema -ResourceGroupName $rgname -WorkspaceName $wsname
Assert-NotNull $schema
Expand All @@ -62,7 +62,7 @@ Get saved searches and search results from a saved search
function Test-SearchGetSavedSearchesAndResults
{
$rgname = "mms-eus"
$wsname = "workspace-861bd466-5400-44be-9552-5ba40823c3aa"
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"

$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname

Expand Down Expand Up @@ -94,20 +94,21 @@ Create a new saved search, update, and then remove it
function Test-SearchSetAndRemoveSavedSearches
{
$rgname = "mms-eus"
$wsname = "workspace-861bd466-5400-44be-9552-5ba40823c3aa"
$wsname = "188087e4-5850-4d8b-9d08-3e5b448eaecd"

$id = "test-new-saved-search-id-2015"
$displayName = "TestingSavedSearch"
$category = "Saved Search Test Category"
$version = 1
$query = "* | measure Count() by Type"
$query = "* | measure Count() by Computer"

# Get the count of saved searches
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
$count = $savedSearches.Value.Count
$newCount = $count + 1
$tags = @{"Group" = "Computer"}

New-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Version $version -Force
New-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Tags $tags -Version $version -Force

# Check that the search was saved
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
Expand All @@ -121,22 +122,28 @@ function Test-SearchSetAndRemoveSavedSearches
}
}

#Set saved search cmdlet has issue with Etag. Temporarily comment out the call until it's fixed.
# Test updating the search
$query = "*"
Set-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Version $version -ETag $etag
#$query = "* | distinct Computer"
#Set-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -DisplayName $displayName -Category $category -Query $query -Tags $tags -Version $version -ETag $etag

# Check that the search was updated
$savedSearches = Get-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname
Assert-AreEqual $savedSearches.Value.Count $newCount

$found = 0
$hasTag = 0
ForEach ($s in $savedSearches.Value)
{
If ($s.Properties.DisplayName.Equals($displayName) -And $s.Properties.Query.Equals($query)) {
$found = 1
If ($s.Properties.Tags["Group"] -eq "Computer") {
$hasTag = 1
}
}
}
Assert-AreEqual $found 1
Assert-AreEqual $hasTag 1


Remove-AzureRmOperationalInsightsSavedSearch -ResourceGroupName $rgname -WorkspaceName $wsname -SavedSearchId $id -Force
Expand Down
Loading