Modules/BenchPress.Azure/Public/Confirm-AppInsights.ps1 (41 lines of code) (raw):
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-AppInsights {
<#
.SYNOPSIS
Confirms that an Application Insights exists.
.DESCRIPTION
The Confirm-AzBPAppInsights cmdlet gets an Application Insights using the specified Application Insights and
Resource Group names.
.PARAMETER Name
The name of the Application Insights.
.PARAMETER ResourceGroupName
The name of the Resource Group. The name is case insensitive.
.EXAMPLE
Confirm-AzBPAppInsights -Name "benchpresstest" -ResourceGroupName "rgbenchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '',
Justification='App Insights is a name of an Azure resource and is not a plural noun')]
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$Name,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName
)
Begin {
$connectResults = Connect-Account
}
Process {
$resource = Get-AzApplicationInsights -ResourceGroupName $ResourceGroupName -Name $Name
[ConfirmResult]::new($resource, $connectResults.AuthenticationData)
}
End { }
}