PureStorage.CBS.AVS.Monitor.ps1

$SCHEMA_VERSION = "1.1.0"
function Update-ResourceGroupTags {
    Param(
        [Parameter(Mandatory=$true)]
        [String]$MonitorResourceGroup,

        [Parameter(Mandatory=$true)]
        [ValidateSet("host", "capacity")]
        [String]$MonitorType,

        [Parameter(Mandatory=$true)]
        [bool] $IsFreshDeployment
    )

    # Add tag to resource group
    $ResourceGroup = Get-AzResourceGroup $MonitorResourceGroup -ErrorAction ignore
    if (-not $ResourceGroup) {
        throw "Resource group $MonitorResourceGroup does not exist"
    }

    $Tags = $ResourceGroup.Tags
    if ($MonitorType -eq "host") {
        $Tags["PureStorage.CBS.AVS.HostMonitor"] = "True"
    }
    if ($MonitorType -eq "capacity") {
        if (-not $IsFreshDeployment) {
            # For backward compatibility, set the HostMonitor tag to true if we are adding a deployment to existing HostMonitor deployment
            if (-not $Tags["PureStorage.CBS.AVS.CapacityMonitor"] ){
                # If CapacityMonitor tag was already set, then compatability check was done in the past
                $Tags["PureStorage.CBS.AVS.HostMonitor"] = "True"
            }
        }
        $Tags["PureStorage.CBS.AVS.CapacityMonitor"] = "True"
    }
    $Tags['PureStorage.CBS.AVS'] = $ProductVersion
    $Tags["PureStorage.CBS.AVS.SCHEMA_VERSION"] = $SCHEMA_VERSION
    Set-AzResourceGroup -Name $MonitorResourceGroup -Tag $Tags
}

function Deploy-MonitoringResource {
    param (
      [Parameter(Mandatory=$true)]
          [String]$MonitorResourceGroup,

          [Parameter(Mandatory=$true)]
          [String]$MonitorResourceGroupRegion,

          [Parameter(Mandatory=$false)]
          [String]$AVSCloudName,

          [Parameter(Mandatory=$false)]
          [String]$AVSResourceGroup,

          [Parameter(Mandatory=$true)]
          [String]$VNetName,

          [Parameter(Mandatory=$true)]
          [String]$VNetResourceGroup,

          [Parameter(ParameterSetName='NewSubnet', Mandatory=$true)]
          [String]$VNetSubnetAddress,

          [Parameter(ParameterSetName='ExistingSubnet', Mandatory=$true)]
          [Parameter(ParameterSetName='NewSubnet', Mandatory=$false)]
          [String]$VNetSubnetName,

          [Parameter(Mandatory=$false)]
          [int]$MonitorIntervalInMinute,

          [Parameter(Mandatory=$false)]
          [ValidateRange(1, 100)]
          [int]$DefaultUtilizationThreshold=$DEFAULT_UTILIZATION_THRESHOLD,

          [Parameter(Mandatory=$true)]
          [ValidateSet("host", "capacity")]
          [string]$MonitorType,

          [Parameter(Mandatory=$false)]
          [int]$DefaultRunCommandTimeoutInMinute=$DEFAULT_RUNCOMMAND_TIMEOUT_IN_MINUTE
    )

    $ProductVersion = (Get-Module "PureStorage.CBS.AVS").Version.ToString()
    $ResourceGroup = Get-AzResourceGroup $MonitorResourceGroup -ErrorAction ignore
    if (-not $ResourceGroup) {
        $IsFreshDeployment = $true
        Write-Host "Resource group $MonitorResourceGroup does not exist. Creating the resource group..."
        New-AzResourceGroup $MonitorResourceGroup -Location $MonitorResourceGroupRegion -Tag @{'PureStorage.CBS.AVS' = $ProductVersion } | Out-Null
    }
    else {
        if ($ResourceGroup.Tags["PureStorage.CBS.AVS"]) {
            $IsFreshDeployment = $false
        }

        if ($ResourceGroup.location -ne $MonitorResourceGroupRegion) {
            throw "The resource group $MonitorResourceGroup exists but its region $($ResourceGroup.location) does not match provided region $MonitorResourceGroupRegion"
        }

        # If the resource group exists and it's empty, we'll use the resource group even though there is no tag
        $Resources = Get-AzResource -ResourceGroupName $MonitorResourceGroup
        if (($Resources.Count -ne 0) -and (-not $ResourceGroup.Tags["PureStorage.CBS.AVS"])) {
            throw "The resource group $MonitorResourceGroup exists but not used by Pure Storage AVS monitor. Please select another name for Pure Storage monitor"
        }
        Update-ResourceGroupTags -MonitorResourceGroup $MonitorResourceGroup -MonitorType $MonitorType -IsFreshDeployment $IsFreshDeployment
    }

    $DeploymentId = (New-Guid).ToString()
    $DeploymentParams = @{        
        "VNetName" = $VNetName;
        "VNetResourceGroupName" = $VNetResourceGroup;
        "DeploymentId" = $DeploymentId
    }

    if ($MonitorType -eq "capacity") {
        $DeploymentTemplatePath = Join-Path -Path $PSScriptRoot -ChildPath 'templates/BaseMonitor' -AdditionalChildPath 'Main.bicep'
        $DeploymentParams["DeploymentType"] = "CapacityMonitor"
        $DeploymentParams["DefaultUtilizationThreshold"] = $DefaultUtilizationThreshold
        $DeploymentParams["capacityMonitorIntervalInMinute"] = $MonitorIntervalInMinute
    }

    if ($MonitorType -eq "host") {
        $DeploymentParams["AVSCloudName"] = $AVSCloudName
        $DeploymentParams["AVSResourceGroup"] = $AVSResourceGroup
        $DeploymentTemplatePath = Join-Path -Path $PSScriptRoot -ChildPath 'templates/BaseMonitor' -AdditionalChildPath 'Main.bicep'
        $DeploymentParams["DeploymentType"] = "HostMonitor"
        $DeploymentParams["MonitorIntervalInMinute"] = $MonitorIntervalInMinute
        $DeploymentParams["DefaultRunCommandTimeoutInMinute"] = $DefaultRunCommandTimeoutInMinute
    }

    if ($VNetSubnetAddress) {
        $DeploymentParams["SubnetAddressRange"] = $VNetSubnetAddress
    }

    if ($VNetSubnetName) {
        $DeploymentParams["SubnetName"] = $VNetSubnetName
    }

    Write-Host "Deploying monitoring infrastructure to Azure..."
    New-AzResourceGroupDeployment -Name "PCBSMonitorDeployment_$DeploymentId" -ResourceGroupName $MonitorResourceGroup `
      -TemplateFile $DeploymentTemplatePath  -TemplateParameterObject $DeploymentParams
  }

  function Add-MonitorArray {
    param (
      [Parameter(Mandatory=$true)]
      [String]$MonitorResourceGroup,

      [Parameter(Mandatory=$true)]
      [String]$PureCloudBlockStoreEndpoint,

      [Parameter(Mandatory=$true)]
      [pscredential]$PureCloudBlockStoreCredential,

      [Parameter(Mandatory=$false)]
      [int] $UtilizationThreshold,

      [Parameter(Mandatory=$true)]
      [ValidateSet("host", "capacity")]
      [String]$MonitorType,

      [Parameter(Mandatory=$false)]
      [Switch]$Force
    )

    $ResourceGroup = Get-AzResourceGroup -Name $MonitorResourceGroup

    if (-not $ResourceGroup) {
        throw "Resource group $MonitorResourceGroup does not exist"
    }

    if (-not $ResourceGroup.Tags["PureStorage.CBS.AVS"]) {
        throw "Resouce group $MonitorResourceGroup specified does not host Pure Storage monitor"
    }

    $PureCloudBlockStoreEndpointOrigin = $PureCloudBlockStoreEndpoint
    Write-Host "Adding Pure Cloud Block Store $PureCloudBlockStoreEndpointOrigin to monitor resource group $MonitorResourceGroup..."

    $UserPrincipalName = (Get-AzContext).Account.Id
    $KeyVault = Get-AzKeyVault -ResourceGroupName $MonitorResourceGroup

    Set-AzKeyVaultAccessPolicy -VaultName $KeyVault.VaultName  -UserPrincipalName $UserPrincipalName -PermissionsToSecrets set,delete,get,purge,list

    if ($Force) {
        Write-Warning "Warning skipping check for $PureCloudBlockStoreEndpoint connectivity."
    }
    else {
        # Make sure the credential works before adding to the monitor
        $Array = Connect-Pfa2array -Endpoint $PureCloudBlockStoreEndpoint -Credential $PureCloudBlockStoreCredential  -IgnoreCertificateError -ErrorAction Ignore
        if (-not $Array) {
            $msg = "Failed to connect to the Pure Cloud Block Store. Please check the endpoint and credential of the Pure Cloud Block Store."
            throw $msg
        }
    }

    if ($PureCloudBlockStoreEndpoint -match "^\d+.\d+.\d+.\d+$") {
        $PureCloudBlockStoreEndpoint = $PureCloudBlockStoreEndpoint.Replace(".", "-")
    }

    $data_prefix = ""
    if ($MonitorType -eq "capacity") {
        $data_prefix = "capacity-"
    }
    $Secret = Get-AzKeyVaultSecret -VaultName $KeyVault.VaultName | where-object {$_.Name -eq "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}username"}
    if ($Secret) {
        Write-Host "Overriding the existing credential for Pure Cloud Block Store $PureCloudBlockStoreEndpointOrigin..."
    }

    Set-AzKeyVaultSecret -VaultName $KeyVault.VaultName -Name "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}username" -SecretValue (ConvertTo-SecureString -String $PureCloudBlockStoreCredential.UserName -AsPlainText -Force)
    Set-AzKeyVaultSecret -VaultName $KeyVault.VaultName -Name "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}password" -SecretValue $PureCloudBlockStoreCredential.Password

    if ($MonitorType -eq "capacity") {

      if ($UtilizationThreshold) {
        Set-AzKeyVaultSecret -VaultName $KeyVault.VaultName -Name "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}threshold" -SecretValue (ConvertTo-SecureString -String $UtilizationThreshold -AsPlainText -Force)
      }
    }

    Write-Host "The Pure Cloud Block Store $PureCloudBlockStoreEndpointOrigin is successfully added to monitor resource group $MonitorResourceGroup."
  }

function Remove-FunctionFromFunctionApp {
    Param(

        [Parameter(Mandatory = $true)]
        [String] $ResourceGroupName,

        [Parameter(Mandatory = $true)]
        [String]$FunctionName,

        [Parameter(Mandatory = $true)]
        [String]$FunctionAppName
    )

    $Context = Get-AzContext
    $SubscriptionId = $Context.Subscription.Id
    Write-Host "Removing function $FunctionName from FunctinApp $FunctionAppName..."
    $uri = "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$FunctionAppName/functions/$($FunctionName)?api-version=2016-08-01"
    Invoke-AzRest -Method DELETE -Path $uri
}

function Get-FunctionFromFunctionApp {
    Param(

        [Parameter(Mandatory = $true)]
        [String] $ResourceGroupName,

        [Parameter(Mandatory = $true)]
        [String]$FunctionName,

        [Parameter(Mandatory = $true)]
        [String]$FunctionAppName
    )

    $Context = Get-AzContext
    $SubscriptionId = $Context.Subscription.Id
    $uri = "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$FunctionAppName/functions/$($FunctionName)?api-version=2016-08-01"
    Invoke-AzRest -Method Get -Path $uri
}

function Test-MonitorFunctionExistence {
    Param(
        [Parameter(Mandatory = $true)]
        [String]$ResourceGroupName,

        [Parameter(Mandatory = $true)]
        [ValidateSet("host", "capacity")]
        [String]$MonitorType
    )

    $FunctionApp = Get-AzFunctionApp -ResourceGroupName $ResourceGroupName -ErrorAction Ignore
    if (-not $FunctionApp) {
        throw "Function App does not exist in the resource group $ResourceGroupName. No valid monitor deployment found. Try to deploy the monitor again"
    }
    if ($MonitorType -eq "host") {
        $FunctionName = "BuildClusterTrigger"
        $ErrorMessage = "AVS host monitor does not exist in the monitor resource group $ResourceGroupName"
    } elseif ($MonitorType -eq "capacity") {
        $FunctionName = "CapacityMonitorTrigger"
        $ErrorMessage = "Capacity monitor does not exist in the monitor resource group $ResourceGroupName"
    }
    $FunctionAppGetResponse = Get-FunctionFromFunctionApp -ResourceGroupName $ResourceGroupName -FunctionName $FunctionName -FunctionAppName $FunctionApp.Name
    if ($FunctionAppGetResponse.StatusCode -ne 200) {
        throw $ErrorMessage
    }
}

  function Remove-Monitor {
    Param(
        [Parameter(Mandatory = $true)]
        [String]$MonitorResourceGroup,

        [Parameter(Mandatory = $true)]
        [ValidateSet("host", "capacity")]
        [String]$MonitorType,

        [Parameter(Mandatory = $false)]
        [Switch]$RemoveSubnet
    )

    $ResourceGroup = Get-AzResourceGroup $MonitorResourceGroup -ErrorAction ignore

    if (-not $ResourceGroup) {
        throw "Pure Storage monitor $MonitorResourceGroup does not exist"
    }

    if ([string]::IsNullOrEmpty($ResourceGroup.Tags["PureStorage.CBS.AVS"])) {
        throw "The resource group provided is not Pure Storage monitor resource group. Only Pure Storage monitor resource group can be removed by this command"
    }

    # smartDetector is auto configured without tag. Ignore this component
    $NonMonitorResources = Get-AzResource -ResourceGroupName $MonitorResourceGroup | Where-Object { [string]::IsNullOrEmpty($_.tags["AVSMonitorResourceGroupName"]) -and $_.ResourceType -ne "microsoft.alertsmanagement/smartDetectorAlertRules"}
    if ($NonMonitorResources.Count -ge 1) {
        throw "Non Pure Storage monitor resource $($MonitorResources.Name) detected. Please manually remove the resource before removing the whole monitor"
    }


    $MonitorFuncApp = Get-AzFunctionApp -ResourceGroupName $MonitorResourceGroup
    $MonitorKeyVault = Get-AzKeyVault -ResourceGroupName $MonitorResourceGroup

    # Vnet name here is constructed as {vNetResouceGUI}-{SubnetName}
    # eg. fece391b-8f4e-4e05-a203-e5961cdd9fd1_subnet-avsfuncappsbqzuuqxofe2q
    $vNetResourceGUID = $MonitorFuncApp.SiteConfig.VnetName.Split("_")[0]
    $MonitorSubnetName = $MonitorFuncApp.SiteConfig.VnetName.Split("_")[1]
    $MonitorVNet = Get-AzVirtualNetwork | Where-Object {$_.ResourceGuid -eq $vNetResourceGUID}

    # Check if we need to do partial removal
    $IsPartial = $false
    if ($MonitorType -eq "host") {
        if ($ResourceGroup.Tags["PureStorage.CBS.AVS.CapacityMonitor"]) {
            $IsPartial = $true

            if ($RemoveSubnet) {
                throw "Cannot remove subnet when the monitor resource group $MonitorResourceGroup is hosting capacity monitor. Please remove the capacity monitor first"
            }
            Write-Warning "The monitor resource group $MonitorResourceGroup is hosting capacity monitor. Removing only the host monitor resources"
            Remove-FunctionFromFunctionApp -ResourceGroupName $MonitorResourceGroup -FunctionName "BuildClusterTrigger" -FunctionAppName $MonitorFuncApp.Name
            $Tags = $ResourceGroup.Tags
            $Tags.Remove("PureStorage.CBS.AVS.HostMonitor")
            Set-AzResourceGroup -Name $MonitorResourceGroup -Tag $Tags
        }
    }

    if ($MonitorType -eq "capacity") {
        if ($ResourceGroup.Tags["PureStorage.CBS.AVS.HostMonitor"]) {
            $IsPartial = $true

            if ($RemoveSubnet) {
                throw "Cannot remove subnet when the monitor resource group $MonitorResourceGroup is hosting host monitor. Please remove the host monitor first"
            }
            Write-Warning "The monitor resource group $MonitorResourceGroup is hosting host monitor. Removing only the capacity monitor resources"
            Remove-FunctionFromFunctionApp -ResourceGroupName $MonitorResourceGroup -FunctionName "CapacityMonitorTrigger" -FunctionAppName $MonitorFuncApp.Name
            $Tags = $ResourceGroup.Tags
            $Tags.Remove("PureStorage.CBS.AVS.CapacityMonitor")
            Set-AzResourceGroup -Name $MonitorResourceGroup -Tag $Tags
        }
    }

    if (-not $IsPartial) {
        Write-Host "Removing resource group $MonitorResourceGroup..."
        Remove-AzResourceGroup $MonitorResourceGroup -Force | Out-Null

        # Remove subnet
        if ($RemoveSubnet) {
            Write-Host "Removing subnet $MonitorSubnetName from vNet $($MonitorVNet.Name)..."
            Remove-AzVirtualNetworkSubnetConfig -Name $MonitorSubnetName -VirtualNetwork $MonitorVNet | Set-AzVirtualNetwork | Out-Null
        }

        # Purge key vault
        Write-Host "Purging key vault $($MonitorKeyVault.VaultName)..."
        Remove-AzKeyVault -Name $MonitorKeyVault.VaultName -InRemovedState -Force -Location $ResourceGroup.Location | Out-Null
    }
  }

  function Remove-MonitorArray {
    Param (
      [Parameter(Mandatory=$true)]
      [String]$MonitorResourceGroup,

      [Parameter(Mandatory=$true)]
      [String]$PureCloudBlockStoreEndpoint,

      [Parameter(Mandatory=$true)]
      [ValidateSet("host", "capacity")]
      [String]$MonitorType
    )
    $ResourceGroup = Get-AzResourceGroup -Name $MonitorResourceGroup

    if (-not $ResourceGroup) {
        throw "Resource group $MonitorResourceGroup does not exist"
    }

    if (-not $ResourceGroup.Tags["PureStorage.CBS.AVS"]) {
        throw "Resouce group $MonitorResourceGroup specified does not host Pure Storage CBS AVS monitor"
    }

    $PureCloudBlockStoreEndpointOrigin = $PureCloudBlockStoreEndpoint
    $KeyVault = Get-AzKeyVault -ResourceGroupName $MonitorResourceGroup
    Write-Host "Removing Pure Cloud Block Store $PureCloudBlockStoreEndpointOrigin from monitor resource group $MonitorResourceGroup..."

    $UserPrincipalName = (Get-AzContext).Account.Id
    Set-AzKeyVaultAccessPolicy -VaultName $KeyVault.VaultName  -UserPrincipalName $UserPrincipalName -PermissionsToSecrets set,delete,get,purge,list

    if ($PureCloudBlockStoreEndpoint -match "^\d+.\d+.\d+.\d+$") {
        $PureCloudBlockStoreEndpoint = $PureCloudBlockStoreEndpoint.Replace(".", "-")
    }

    $data_prefix = ""
    if ($MonitorType -eq "capacity") {
        $data_prefix = "capacity-"
    }
    $Secret = Get-AzKeyVaultSecret -VaultName $KeyVault.VaultName | where-object {$_.Name -eq "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}username"}
    if (-not $Secret) {
        throw "Pure Cloud Block Store $PureCloudBlockStoreEndpointOrigin does not exist in the monitor resource group $MonitorResourceGroup"
    }

    Remove-AzKeyVaultSecret -VaultName $KeyVault.VaultName -Name "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}username" -Force
    Remove-AzKeyVaultSecret -VaultName $KeyVault.VaultName -Name "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}password" -Force

    # Purge secret
    Purge-AzureSecretWithRetry -KeyVaultName $KeyVault.VaultName -SecretName "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}username"
    Purge-AzureSecretWithRetry -KeyVaultName $KeyVault.VaultName -SecretName "$($PureCloudBlockStoreEndpoint)-$($KeyVault.VaultName)-${data_prefix}password"


    Write-Host "The Pure Cloud Block Store $PureCloudBlockStoreEndpointOrigin is successfully removed."
  }

  function Get-Monitor {
    param (
        [Parameter(Mandatory=$true)]
        [String]$MonitorResourceGroup,
        [Parameter(Mandatory=$true)]
        [ValidateSet("host", "capacity")]
        [String]$MonitorType
      )

    $ResourceGroup = Get-AzResourceGroup -Name $MonitorResourceGroup

    if (-not $ResourceGroup) {
        throw "Resource group $MonitorResourceGroup does not exist"
    }

    if (-not $ResourceGroup.Tags["PureStorage.CBS.AVS"]) {
        throw "Resouce group $MonitorResourceGroup specified does not host Pure Storage CBS AVS monitor"
    }

    Test-MonitorFunctionExistence -ResourceGroupName $MonitorResourceGroup -MonitorType $MonitorType

    # Get global utilization threshold
    if ($MonitorType -eq "capacity") {
        $DefaultUtilizationThreshold = Get-MonitorEnvironmentConfig -ResourceGroupName $MonitorResourceGroup -ConfigName "DEFAULT_UTILIZATION_THRESHOLD"
    }

    if ($MonitorType -eq "host") {
        $DefaultRunCommandTimeoutInMinute = Get-MonitorEnvironmentConfig -ResourceGroupName $MonitorResourceGroup -ConfigName "DEFAULT_RUNCOMMAND_TIMEOUT_IN_MINUTE"
    }

    $KeyVault = Get-AzKeyVault -ResourceGroupName $MonitorResourceGroup -ErrorAction Ignore
    if (-not $KeyVault) {
        throw "Key Vault does not exist in the monitor resource group $MonitorResourceGroup. No valid monitor deployment found. Try to deploy the monitor again"
    }

    # List CBS arras and their corresponding utilization threshold
    $UserPrincipalName = (Get-AzContext).Account.Id
    $KeyVault = Get-AzKeyVault -ResourceGroupName $MonitorResourceGroup
    Set-AzKeyVaultAccessPolicy -VaultName $KeyVault.VaultName  -UserPrincipalName $UserPrincipalName -PermissionsToSecrets set,delete,get,purge,list

    if ($MonitorType -eq "capacity") {
        $SecretSplitter = "-$($KeyVault.VaultName)-capacity-username"
    } elseif ($MonitorType -eq "host"){
        $SecretSplitter = "-$($KeyVault.VaultName)-username"
    }
    $Secrets = Get-AzKeyVaultSecret -VaultName $KeyVault.VaultName | where-object {$_.Name -like "*$($SecretSplitter)"}
    $MonitorArrays = @()
    foreach ($Secret in $Secrets) {
        $ArrayName = ($Secret.name -Split $SecretSplitter)[0]
        if ($MonitorType -eq "capacity") {
            $EncodedThreshold = Get-AzKeyVaultSecret -VaultName $KeyVault.VaultName -Name "$($ArrayName)-$($KeyVault.VaultName)-capacity-threshold"
            if ($EncodedThreshold) {
                $Threshold = [int] (ConvertFrom-SecureString -SecureString $EncodedThreshold.SecretValue -AsPlainText)
            }
            else {
                $Threshold = $null
            }
        }

        # If the string matches the format like "172-168-1-0", the array ip addressed was processed because secret name does not allow "."
        if ($ArrayName -match "^\d+-\d+-\d+-\d+$") {
            $ArrayName = $ArrayName.Replace("-", ".")
        }

        $MonitorArrays += @{ArrayName = $ArrayName; Threshold=$Threshold}
    }

    $MonitorFuncApp = Get-AzFunctionApp -ResourceGroupName $MonitorResourceGroup

    # Vnet name here is constructed as {vNetResouceGUI}-{SubnetName}
    # eg. fece391b-8f4e-4e05-a203-e5961cdd9fd1_subnet-avsfuncappsbqzuuqxofe2q
    $vNetResourceGUID = $MonitorFuncApp.SiteConfig.VnetName.Split("_")[0]
    $MonitorSubnetName = $MonitorFuncApp.SiteConfig.VnetName.Split("_")[1]

    $MonitorVNet = Get-AzVirtualNetwork | Where-Object {$_.ResourceGuid -eq $vNetResourceGUID}
    $MonitorSubnet = Get-AzVirtualNetworkSubnetConfig -Name $MonitorSubnetName -VirtualNetwork $MonitorVNet

    if ($MonitorType -eq "capacity") {
        $result = [PSCustomObject]@{
            DefaultUtilizationThreshold   = $DefaultUtilizationThreshold
            MonitorArrays                 = $MonitorArrays
            MonitorResourceGroupName      = $ResourceGroup.ResourceGroupName
            MonitorRegion                 = $ResourceGroup.location
            MonitorVnetName               = $MonitorVNet.Name
            MonitorVnetResourceGroupName  = $MonitorVNet.ResourceGroupName
            MonitorVnetRegion             = $MonitorVNet.Location
            MonitorVnetProvisioningState  = $MonitorVNet.ProvisioningState
            MonitorSubnetName             = $MonitorSubnet.Name
            MonitorSubnetAddressPrefix    = $MonitorSubnet.AddressPrefix
        }
    } elseif ($MonitorType -eq "host") {
        $result = [PSCustomObject]@{
            MonitorArrays                 = $MonitorArrays
            MonitorResourceGroupName      = $ResourceGroup.ResourceGroupName
            MonitorRegion                 = $ResourceGroup.location
            MonitorVnetName               = $MonitorVNet.Name
            MonitorVnetResourceGroupName  = $MonitorVNet.ResourceGroupName
            MonitorVnetRegion             = $MonitorVNet.Location
            MonitorVnetProvisioningState  = $MonitorVNet.ProvisioningState
            MonitorSubnetName             = $MonitorSubnet.Name
            MonitorSubnetAddressPrefix    = $MonitorSubnet.AddressPrefix
            DefaultRunCommandTimeoutInMinute = $DefaultRunCommandTimeoutInMinute
        }
    }
    
    return $result
  }

  function Get-MonitorEnvironmentConfig {
    [CmdletBinding()]
    Param (
      [Parameter(Mandatory = $true)]
      $ResourceGroupName,
      [Parameter(Mandatory = $true)]
      [ValidateSet("DEFAULT_UTILIZATION_THRESHOLD", "DEFAULT_RUNCOMMAND_TIMEOUT_IN_MINUTE")]
      $ConfigName
    )
  
    $AzFunctionApp = Get-AzFunctionApp -ResourceGroupName $ResourceGroupName
    if (-not $AzFunctionApp) {
      throw "Azure function does not exist in the resource group $ResourceGroupName"
    }
    $AppSettings = Get-AzFunctionAppSetting -ResourceGroupName $ResourceGroupName -Name $AzFunctionApp.Name

    $ConfigValue = if ($ConfigName -eq "DEFAULT_UTILIZATION_THRESHOLD") {
      $DEFAULT_UTILIZATION_THRESHOLD
    } elseif ($ConfigName -eq "DEFAULT_RUNCOMMAND_TIMEOUT_IN_MINUTE") {
      $DEFAULT_RUNCOMMAND_TIMEOUT_IN_MINUTE
    }

    if ($AppSettings[$ConfigName]) {
      $ConfigValue = [int]$AppSettings[$ConfigName]
    }
    return $ConfigValue
  }
# SIG # Begin signature block
# MIIuiQYJKoZIhvcNAQcCoIIuejCCLnYCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB6V/pH/Ims6nFF
# oijU4hXHRdch5O4EhyHoGPfSopVn9qCCE2gwggVyMIIDWqADAgECAhB2U/6sdUZI
# k/Xl10pIOk74MA0GCSqGSIb3DQEBDAUAMFMxCzAJBgNVBAYTAkJFMRkwFwYDVQQK
# ExBHbG9iYWxTaWduIG52LXNhMSkwJwYDVQQDEyBHbG9iYWxTaWduIENvZGUgU2ln
# bmluZyBSb290IFI0NTAeFw0yMDAzMTgwMDAwMDBaFw00NTAzMTgwMDAwMDBaMFMx
# CzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSkwJwYDVQQD
# EyBHbG9iYWxTaWduIENvZGUgU2lnbmluZyBSb290IFI0NTCCAiIwDQYJKoZIhvcN
# AQEBBQADggIPADCCAgoCggIBALYtxTDdeuirkD0DcrA6S5kWYbLl/6VnHTcc5X7s
# k4OqhPWjQ5uYRYq4Y1ddmwCIBCXp+GiSS4LYS8lKA/Oof2qPimEnvaFE0P31PyLC
# o0+RjbMFsiiCkV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