Merge branch 'main' into feature/251-role-assignment

This commit is contained in:
Caroline 2023-03-31 11:48:20 -07:00
Родитель 129e8b7685 2d406ff60b
Коммит 0ed3a37938
46 изменённых файлов: 1333 добавлений и 53 удалений

1
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -55,6 +55,7 @@ jobs:
shell: pwsh
run: |
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
Install-Module -Name Az.App -Scope CurrentUser -Repository PSGallery -Force
Publish-Module -Path ./BenchPress.Azure -Repository LocalFeedPSRepo -Verbose
- name: Install AzBP Module from the repository
shell: pwsh

1
.github/workflows/pr-powershell.yml поставляемый
Просмотреть файл

@ -24,6 +24,7 @@ jobs:
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module Az -ErrorAction Stop
Install-Module Az.App -ErrorAction Stop
Install-Module Pester -ErrorAction Stop
- name: Run PowerShell Unit Tests
shell: pwsh

Просмотреть файл

@ -13,9 +13,15 @@
FunctionsToExport = @(
"Confirm-ActionGroup",
"Confirm-AksCluster",
"Confirm-ApiManagement",
"Confirm-ApiManagementApi",
"Confirm-ApiManagementDiagnostic",
"Confirm-ApiManagementLogger",
"Confirm-ApiManagementPolicy",
"Confirm-AppInsights",
"Confirm-AppServicePlan",
"Confirm-BicepFile",
"Confirm-ContainerApp",
"Confirm-ContainerRegistry",
"Confirm-CosmosDBAccount",
"Confirm-CosmosDBGremlinDatabase",

Просмотреть файл

@ -1,8 +1,14 @@
enum ResourceType{
ActionGroup
AksCluster
ApiManagement
ApiManagementApi
ApiManagementDiagnostic
ApiManagementLogger
ApiManagementPolicy
AppInsights
AppServicePlan
ContainerApp
CosmosDBAccount
CosmosDBGremlinDatabase
CosmosDBMongoDBDatabase

Просмотреть файл

@ -0,0 +1,49 @@
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-ApiManagement {
<#
.SYNOPSIS
Confirms that an API Management Service exists.
.DESCRIPTION
The Confirm-AzBPApiManagement cmdlet gets an API Management Service using the specified API Management Service
and Resource Group names.
.PARAMETER ResourceGroupName
Specifies the name of the resource group under in which this cmdlet gets the API Management service.
.PARAMETER Name
Specifies the name of API Management service.
.EXAMPLE
Confirm-AzBPApiManagement -ResourceGroupName "rgbenchpresstest" -Name "benchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$Name
)
Begin {
$ConnectResults = Connect-Account
}
Process {
$Resource = Get-AzApiManagement -ResourceGroupName $ResourceGroupName -Name $Name
[ConfirmResult]::new($Resource, $ConnectResults.AuthenticationData)
}
End { }
}

Просмотреть файл

@ -0,0 +1,56 @@
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-ApiManagementApi {
<#
.SYNOPSIS
Confirms that an API Management API exists.
.DESCRIPTION
The Confirm-AzBPApiManagementApi cmdlet gets an API Management API using the specified API, API Management
Service, and Resource Group names.
.PARAMETER ResourceGroupName
Specifies the name of the resource group under which an API Management service is deployed.
.PARAMETER ServiceName
Specifies the name of the deployed API Management service.
.PARAMETER Name
Specifies the name of the API to get.
.EXAMPLE
Confirm-AzBPApiManagementApi -ResourceGroupName "rgbenchpresstest" -ServiceName "servicetest" -Name "benchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$ServiceName,
[Parameter(Mandatory=$true)]
[string]$Name
)
Begin {
$ConnectResults = Connect-Account
}
Process {
$Resource = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName
| Get-AzApiManagementApi -Name $Name
[ConfirmResult]::new($Resource, $ConnectResults.AuthenticationData)
}
End { }
}

Просмотреть файл

@ -0,0 +1,57 @@
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-ApiManagementDiagnostic {
<#
.SYNOPSIS
Confirms that an API Management Diagnostic exists.
.DESCRIPTION
The Confirm-AzBPApiManagementDiagnostic cmdlet gets an API Management Diagnostic using the specified API
Diagnostic, API, API Management Service, and Resource Group names.
.PARAMETER ResourceGroupName
Specifies the name of the resource group under which an API Management service is deployed.
.PARAMETER ServiceName
Specifies the name of the deployed API Management service.
.PARAMETER Name
Identifier of existing diagnostic. This will return product-scope policy. This parameters is required.
.EXAMPLE
Confirm-AzBPApiManagementDiagnostic -ResourceGroupName "rgbenchpresstest" -ServiceName "servicetest" `
-Name "benchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$ServiceName,
[Parameter(Mandatory=$true)]
[string]$Name
)
Begin {
$ConnectResults = Connect-Account
}
Process {
$Resource = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName
| Get-AzApiManagementDiagnostic -DiagnosticId $Name
[ConfirmResult]::new($Resource, $ConnectResults.AuthenticationData)
}
End { }
}

Просмотреть файл

@ -0,0 +1,58 @@
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-ApiManagementLogger {
<#
.SYNOPSIS
Confirms that an API Management Logger exists.
.DESCRIPTION
The Confirm-AzBPApiManagementLogger cmdlet gets an API Management Logger using the specified Logger, API
Management Service, and Resource Group names.
.PARAMETER ResourceGroupName
Specifies the name of the resource group under which an API Management service is deployed.
.PARAMETER ServiceName
Specifies the name of the deployed API Management service.
.PARAMETER Name
Specifies the ID of the specific logger to get.
.EXAMPLE
Confirm-AzBPApiManagementLogger -ResourceGroupName "rgbenchpresstest" -ServiceName "servicetest" `
-Name "benchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$ServiceName,
[Parameter(Mandatory=$true)]
[string]$Name
)
Begin {
$ConnectResults = Connect-Account
}
Process {
# Unlike the other Get-AzApiManagement* cmdlets Get-AzApiManagementLogger does not accept piping of the context
$Context = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName
$Resource = Get-AzApiManagementLogger -Context $Context -LoggerId $Name
[ConfirmResult]::new($Resource, $ConnectResults.AuthenticationData)
}
End { }
}

Просмотреть файл

@ -0,0 +1,62 @@
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-ApiManagementPolicy {
<#
.SYNOPSIS
Confirms that an API Management Policy exists.
.DESCRIPTION
The Confirm-AzBPApiManagementPolicy cmdlet gets an API Management Policy using the specified API, API Management
Service, and Resource Group names.
.PARAMETER ResourceGroupName
Specifies the name of the resource group under which an API Management service is deployed.
.PARAMETER ServiceName
Specifies the name of the deployed API Management service.
.PARAMETER ApiId
Specifies the identifier of the existing API. This cmdlet returns the API-scope policy.
.EXAMPLE
Confirm-AzBPApiManagementPolicy -ResourceGroupName "rgbenchpresstest" -ServiceName "servicetest" `
-ApiId "benchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[Parameter(Mandatory=$true)]
[string]$ServiceName,
[Parameter(Mandatory=$true)]
[string]$ApiId
)
Begin {
$ConnectResults = Connect-Account
}
Process {
$policy = New-AzApiManagementContext -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName
| Get-AzApiManagementPolicy -ApiId $ApiId
# Get-AzApiManagementPolicy returns the XML for a policy, not a resource
if ([string]::IsNullOrWhiteSpace($policy)) {
$policy = $null
}
[ConfirmResult]::new($policy, $ConnectResults.AuthenticationData)
}
End { }
}

Просмотреть файл

@ -0,0 +1,49 @@
# INLINE_SKIP
using module ./../Classes/ConfirmResult.psm1
. $PSScriptRoot/../Private/Connect-Account.ps1
# end INLINE_SKIP
function Confirm-ContainerApp {
<#
.SYNOPSIS
Confirms that a Container Application exists.
.DESCRIPTION
The Confirm-AzBPContainerApp cmdlet gets a Container Application using the specified Container Application and
Resource Group name.
.PARAMETER Name
The name of the Container Application
.PARAMETER ResourceGroupName
The name of the Resource Group
.EXAMPLE
Confirm-AzBPContainerApp -Name "benchpresstest" -ResourceGroupName "rgbenchpresstest"
.INPUTS
System.String
.OUTPUTS
ConfirmResult
#>
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory=$true)]
[string]$Name,
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName
)
Begin {
$ConnectResults = Connect-Account
}
Process {
$Resource = Get-AzContainerApp -ResourceGroupName $ResourceGroupName -Name $Name
[ConfirmResult]::new($Resource, $ConnectResults.AuthenticationData)
}
End { }
}

Просмотреть файл

@ -78,20 +78,14 @@ function Confirm-Resource {
[CmdletBinding()]
[OutputType([ConfirmResult])]
param (
[Parameter(Mandatory = $true)]
[ResourceType]$ResourceType,
[Parameter(Mandatory = $false)]
[string]$ResourceName,
[Parameter(Mandatory = $false)]
[string]$ResourceGroupName,
[Parameter(Mandatory = $false)]
[string]$NamespaceName,
[Parameter(Mandatory = $false)]
[string]$EventHubName,
[Parameter(Mandatory = $true)]
[ResourceType]$ResourceType,
[Parameter(Mandatory = $false)]
[string]$ServerName,
@ -99,6 +93,12 @@ function Confirm-Resource {
[Parameter(Mandatory = $false)]
[string]$DataFactoryName,
[Parameter(Mandatory = $false)]
[string]$NamespaceName,
[Parameter(Mandatory = $false)]
[string]$EventHubName,
[Parameter(Mandatory = $false)]
[string]$WorkspaceName,
@ -114,6 +114,9 @@ function Confirm-Resource {
[Parameter(Mandatory = $false)]
[string]$AccountName,
[Parameter(Mandatory = $false)]
[string]$ServiceName,
[Parameter(Mandatory = $false)]
[string]$PropertyKey,

Просмотреть файл

@ -43,29 +43,7 @@ function Get-ResourceByType {
The name of the Resource Group
.PARAMETER ResourceType
The type of the Resource (currently support the following:
ActionGroup
AksCluster
AppInsights
AppServicePlan
ContainerRegistry
DataFactory
DataFactoryLinkedService
EventHub
EventHubConsumerGroup
EventHubNamespace
KeyVault
ResourceGroup
SqlDatabase
SqlServer
StorageAccount
StorageContainer
StreamAnalyticsCluster
SynapseSparkPool
SynapseSqlPool
SynapseWorkspace
VirtualMachine
WebApp)
The type of the Resource.
.PARAMETER ServerName
If testing an Azure SQL Database resource, the name of the server to which the database is assigned.
@ -79,7 +57,12 @@ function Get-ResourceByType {
the name of the workspace to which the resource is assigned.
.PARAMETER AccountName
If the Azure resource has an associated account name (e.g., Cosmos DB SQL Database, Storage Container),
If the Azure resource has an associated account name (e.g., Cosmos DB SQL Database, Storage Container) this is
the parameter to use to pass the account name.
.PARAMETER ServiceName
If the Azure resource is associated with a service (e.g, API Management Service) this is the parameter to use to
pass the service name.
.EXAMPLE
Get-AzBPResourceByType -ResourceType ActionGroup -ResourceName "bpactiongroup" -ResourceGroupName "rgbenchpresstest"
@ -130,7 +113,10 @@ function Get-ResourceByType {
[string]$Scope,
[Parameter(Mandatory = $false)]
[string]$RoleDefinitionName
[string]$RoleDefinitionName,
[Parameter(Mandatory = $false)]
[string]$ServiceName
)
Begin { }
Process {
@ -141,12 +127,50 @@ function Get-ResourceByType {
"AksCluster" {
return Confirm-AksCluster -AKSName $ResourceName -ResourceGroupName $ResourceGroupName
}
"ApiManagement" {
return Confirm-ApiManagement -ResourceGroupName $ResourceGroupName -Name $ResourceName
}
"ApiManagementApi" {
$params = @{
ResourceGroupName = $ResourceGroupName
ServiceName = $ServiceName
Name = $ResourceName
}
return Confirm-ApiManagementApi @params
}
"ApiManagementDiagnostic" {
$params = @{
ResourceGroupName = $ResourceGroupName
ServiceName = $ServiceName
Name = $ResourceName
}
return Confirm-ApiManagementDiagnostic @params
}
"ApiManagementLogger" {
$params = @{
ResourceGroupName = $ResourceGroupName
ServiceName = $ServiceName
Name = $ResourceName
}
return Confirm-ApiManagementLogger @params
}
"ApiManagementPolicy" {
$params = @{
ResourceGroupName = $ResourceGroupName
ServiceName = $ServiceName
ApiId = $ResourceName
}
return Confirm-ApiManagementPolicy @params
}
"AppInsights" {
return Confirm-AppInsights -ResourceGroupName $ResourceGroupName -Name $ResourceName
}
"AppServicePlan" {
return Confirm-AppServicePlan -AppServicePlanName $ResourceName -ResourceGroupName $ResourceGroupName
}
"ContainerApp" {
return Confirm-ContainerApp -ResourceGroupName $ResourceGroupName -Name $ResourceName
}
"ContainerRegistry" {
return Confirm-ContainerRegistry -Name $ResourceName -ResourceGroupName $ResourceGroupName
}

Просмотреть файл

@ -0,0 +1,23 @@
BeforeAll {
. $PSScriptRoot/../../Public/Confirm-ApiManagement.ps1
. $PSScriptRoot/../../Private/Connect-Account.ps1
Import-Module Az
}
Describe "Confirm-ApiManagement" {
Context "unit tests" -Tag "Unit" {
BeforeEach {
Mock Connect-Account{}
}
It "Calls Get-AzApiManagement" {
Mock Get-AzApiManagement{}
Confirm-ApiManagement -Name "apim" -ResourceGroupName "rgn"
Should -Invoke -CommandName "Get-AzApiManagement" -Times 1
}
}
}
AfterAll {
Remove-Module Az
}

Просмотреть файл

@ -0,0 +1,26 @@
BeforeAll {
. $PSScriptRoot/../../Public/Confirm-ApiManagementApi.ps1
. $PSScriptRoot/../../Private/Connect-Account.ps1
Import-Module Az
}
Describe "Confirm-ApiManagementApi" {
Context "unit tests" -Tag "Unit" {
BeforeEach {
Mock Connect-Account{}
Mock Get-AzApiManagementApi{}
Mock New-AzApiManagementContext{
New-MockObject -Type 'Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementContext'
}
}
It "Calls Get-AzApiManagementApi" {
Confirm-ApiManagementApi -ResourceGroupName "rgn" -ServiceName "sn" -Name "api"
Should -Invoke -CommandName "Get-AzApiManagementApi" -Times 1
}
}
}
AfterAll {
Remove-Module Az
}

Просмотреть файл

@ -0,0 +1,26 @@
BeforeAll {
. $PSScriptRoot/../../Public/Confirm-ApiManagementDiagnostic.ps1
. $PSScriptRoot/../../Private/Connect-Account.ps1
Import-Module Az
}
Describe "Confirm-ApiManagementDiagnostic" {
Context "unit tests" -Tag "Unit" {
BeforeEach {
Mock Connect-Account{}
Mock Get-AzApiManagementDiagnostic{}
Mock New-AzApiManagementContext{
New-MockObject -Type 'Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementContext'
}
}
It "Calls Get-AzApiManagementDiagnostic" {
Confirm-ApiManagementDiagnostic -ResourceGroupName "rgn" -ServiceName "sn" -Name "diag"
Should -Invoke -CommandName "Get-AzApiManagementDiagnostic" -Times 1
}
}
}
AfterAll {
Remove-Module Az
}

Просмотреть файл

@ -0,0 +1,26 @@
BeforeAll {
. $PSScriptRoot/../../Public/Confirm-ApiManagementLogger.ps1
. $PSScriptRoot/../../Private/Connect-Account.ps1
Import-Module Az
}
Describe "Confirm-ApiManagementLogger" {
Context "unit tests" -Tag "Unit" {
BeforeEach {
Mock Connect-Account{}
Mock Get-AzApiManagementLogger{}
Mock New-AzApiManagementContext{
New-MockObject -Type 'Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementContext'
}
}
It "Calls Get-AzApiManagementLogger" {
Confirm-ApiManagementLogger -ResourceGroupName "rgn" -ServiceName "sn" -Name "logger"
Should -Invoke -CommandName "Get-AzApiManagementLogger" -Times 1
}
}
}
AfterAll {
Remove-Module Az
}

Просмотреть файл

@ -0,0 +1,26 @@
BeforeAll {
. $PSScriptRoot/../../Public/Confirm-ApiManagementPolicy.ps1
. $PSScriptRoot/../../Private/Connect-Account.ps1
Import-Module Az
}
Describe "Confirm-ApiManagementPolicy" {
Context "unit tests" -Tag "Unit" {
BeforeEach {
Mock Connect-Account{}
Mock Get-AzApiManagementPolicy{}
Mock New-AzApiManagementContext{
New-MockObject -Type 'Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementContext'
}
}
It "Calls Get-AzApiManagementPolicy" {
Confirm-ApiManagementPolicy -ResourceGroupName "rgn" -ServiceName "sn" -ApiId "apiid"
Should -Invoke -CommandName "Get-AzApiManagementPolicy" -Times 1
}
}
}
AfterAll {
Remove-Module Az
}

Просмотреть файл

@ -0,0 +1,23 @@
BeforeAll {
. $PSScriptRoot/../../Public/Confirm-ContainerApp.ps1
. $PSScriptRoot/../../Private/Connect-Account.ps1
Import-Module Az
}
Describe "Confirm-ContainerApp" {
Context "unit tests" -Tag "Unit" {
BeforeEach {
Mock Connect-Account{}
}
It "Calls Get-AzContainerApp" {
Mock Get-AzContainerApp{}
Confirm-ContainerApp -Name "ca" -ResourceGroupName "rgn"
Should -Invoke -CommandName "Get-AzContainerApp" -Times 1
}
}
}
AfterAll {
Remove-Module Az
}

Просмотреть файл

@ -18,6 +18,9 @@ as their testing framework and runner. To use BenchPress, have the following ins
- [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows)
(PowerShell 7+ recommended)
- [Az PowerShell module](https://learn.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-9.3.0)
- [Az.App PowerShell module](https://learn.microsoft.com/en-us/powershell/module/az.app/?view=azps-9.5.0) for any
testing of Container Applications. Az.App is not GA yet which is why it is not included with the main Az
PowerShell module.
- [Pester](https://pester.dev/docs/introduction/installation)
- [Bicep](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/install#azure-powershell)
- [Service Principal](https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal)

Просмотреть файл

@ -88,6 +88,6 @@ Describe 'Verify Action Group' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -88,6 +88,6 @@ Describe 'Verify AKS Cluster' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -0,0 +1,371 @@
BeforeAll {
Import-Module Az.InfrastructureTesting
$Script:rgName = 'rg-test'
$Script:apiServiceName = 'servicetest'
$Script:apiName = 'apitest'
$Script:location = 'westus3'
}
Describe 'Verify API Management Service' {
BeforeAll {
$Script:noApiServiceName = 'noservice'
}
It 'Should contain an API Management Service with the given name - Confirm-AzBPResource' {
#arrange
$params = @{
ResourceType = "ApiManagement"
ResourceGroupName = $rgName
ResourceName = $apiServiceName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain an API Management Service named $apiServiceName - ConfirmAzBPResource" {
#arrange
$params = @{
ResourceType = "ApiManagement"
ResourceGroupName = $rgName
ResourceName = $apiServiceName
PropertyKey = 'Name'
PropertyValue = $apiServiceName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It 'Should contain an API Management Service with the given name' {
(Confirm-AzBPApiManagement -ResourceGroupName $rgName -Name $apiServiceName).Success | Should -Be $true
}
It 'Should not contain an API Management Service with the given name' {
#arrange
$params = @{
ResourceGroupName = $rgName
Name = $noApiServiceName
ErrorAction = "SilentlyContinue"
}
#act and assert
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
(Confirm-AzBPApiManagement @params).Success | Should -Be $false
}
It "Should contain an API Management Service named $apiServiceName" {
Confirm-AzBPApiManagement -ResourceGroupName $rgName -Name $apiServiceName | Should -BeDeployed
}
It "Should contain an API Management Service named $apiServiceName in $location" {
Confirm-AzBPApiManagement -ResourceGroupName $rgName -Name $apiServiceName | Should -BeInLocation $location
}
It "Should be an API Management Service in a resource group named $rgName" {
Confirm-AzBPApiManagement -ResourceGroupName $rgName -Name $apiServiceName | Should -BeInResourceGroup $rgName
}
}
Describe 'Verify API Management API' {
BeforeAll {
$Script:noApiName = 'noapi'
}
It 'Should contain an API Management API with the given name - Confirm-AzBPResource' {
#arrange
$params = @{
ResourceType = "ApiManagementApi"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $apiName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain an API Management API named $apiName - ConfirmAzBPResource" {
#arrange
$params = @{
ResourceType = "ApiManagementApi"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $apiName
PropertyKey = 'Name'
PropertyValue = $apiName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It 'Should contain an API Management API with the given name' {
(Confirm-AzBPApiManagementApi -ResourceGroupName $rgName -ServiceName $apiServiceName -Name $apiName).Success
| Should -Be $true
}
It 'Should not contain an API Management API with the given name' {
# arrange
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
$params = @{
ResourceGroupName = $rgName
Name = $noApiName
ServiceName = $apiServiceName
ErrorAction = "SilentlyContinue"
}
#act and assert
(Confirm-AzBPApiManagementApi @params).Success | Should -Be $false
}
It "Should contain an API Management API named $apiName" {
Confirm-AzBPApiManagementApi -ResourceGroupName $rgName -ServiceName $apiServiceName -Name $apiName
| Should -BeDeployed
}
It "Should be an API Management API in a resource group named $rgName" {
Confirm-AzBPApiManagementApi -ResourceGroupName $rgName -ServiceName $apiServiceName -Name $apiName
| Should -BeInResourceGroup $rgName
}
}
Describe 'Verify API Management Diagnostic' {
BeforeAll {
$Script:diagnosticName = 'diagtest'
$Script:noDiagnosticName = 'nodiag'
}
It 'Should contain an API Management Diagnostic with the given name - Confirm-AzBPResource' {
#arrange
$params = @{
ResourceType = "ApiManagementDiagnostic"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $diagnosticName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain an API Management Diagnostic named $diagnosticName - ConfirmAzBPResource" {
#arrange
$params = @{
ResourceType = "ApiManagementDiagnostic"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $diagnosticName
PropertyKey = 'DiagnosticId'
PropertyValue = $diagnosticName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It 'Should contain an API Management Diagnostic with the given name' {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $diagnosticName
}
#act and assert
(Confirm-AzBPApiManagementDiagnostic @params).Success | Should -Be $true
}
It 'Should not contain an API Management Diagnostic with the given name' {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $noDiagnosticName
ErrorAction = "SilentlyContinue"
}
#act and assert
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
(Confirm-AzBPApiManagementDiagnostic @params).Success | Should -Be $false
}
It "Should contain an API Management Diagnostic named $diagnosticName" {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $diagnosticName
}
#act and assert
Confirm-AzBPApiManagementDiagnostic @params | Should -BeDeployed
}
It "Should be an API Management Diagnostic in a resource group named $rgName" {
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $diagnosticName
}
#act and assert
Confirm-AzBPApiManagementDiagnostic @params | Should -BeInResourceGroup $rgName
}
}
Describe 'Verify API Management Logger' {
BeforeAll {
$Script:loggerName = 'loggertest'
$Script:noLoggerName = 'nologger'
}
It 'Should contain an API Management Logger with the given name - Confirm-AzBPResource' {
#arrange
$params = @{
ResourceType = "ApiManagementLogger"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $loggerName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain an API Management Logger named $loggerName - ConfirmAzBPResource" {
#arrange
$params = @{
ResourceType = "ApiManagementLogger"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $loggerName
PropertyKey = 'LoggerId'
PropertyValue = $loggerName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It 'Should contain an API Management Logger with the given name' {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $loggerName
}
#act and assert
(Confirm-AzBPApiManagementLogger @params).Success | Should -Be $true
}
It 'Should not contain an API Management Logger with the given name' {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $noLoggerName
ErrorAction = "SilentlyContinue"
}
#act and assert
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
(Confirm-AzBPApiManagementLogger @params).Success | Should -Be $false
}
It "Should contain an API Management Logger named $loggerName" {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $loggerName
}
#act and assert
Confirm-AzBPApiManagementLogger @params | Should -BeDeployed
}
It "Should be an API Management Logger in a resource group named $rgName" {
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
Name = $loggerName
}
#act and assert
Confirm-AzBPApiManagementLogger @params | Should -BeInResourceGroup $rgName
}
}
Describe 'Verify API Management Policy' {
BeforeAll {
$Script:noApiId = 'nopolicy'
}
It "Should contain an API Management Policy for the API ID $apiName - Confirm-AzBPResource" {
#arrange
$params = @{
ResourceType = "ApiManagementPolicy"
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ResourceName = $apiName
}
#act and assert
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain an API Management Policy for the API ID $apiName" {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ApiId = $apiName
}
#act and assert
(Confirm-AzBPApiManagementPolicy @params).Success | Should -Be $true
}
It "Should not contain an API Management Policy for the API ID $apiName" {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ApiId = $noApiId
ErrorAction = "SilentlyContinue"
}
#act and assert
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
(Confirm-AzBPApiManagementPolicy @params).Success | Should -Be $false
}
It "Should contain an API Management Policy for the API ID $apiName" {
#arrange
$params = @{
ResourceGroupName = $rgName
ServiceName = $apiServiceName
ApiId = $apiName
}
#act and assert
Confirm-AzBPApiManagementPolicy @params | Should -BeDeployed
}
}
AfterAll {
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -0,0 +1,85 @@
param serviceName string = 'apim${take(uniqueString(resourceGroup().id), 5)}'
param location string = resourceGroup().location
resource apiManagementService 'Microsoft.ApiManagement/service@2022-08-01' = {
name: serviceName
location: location
sku: {
capacity: 1
name: 'Developer'
}
properties: {
publisherEmail: 'email@contoso.com'
publisherName: 'Contoso'
}
}
param apiName string = 'api${take(uniqueString(resourceGroup().id), 5)}'
resource api 'Microsoft.ApiManagement/service/apis@2022-08-01' = {
name: apiName
parent: apiManagementService
properties: {
displayName: 'api'
path: '/'
protocols: ['https']
}
}
param workspaceName string = 'logworkspace${take(uniqueString(resourceGroup().id), 5)}'
resource workspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: workspaceName
location: location
properties: {
sku: {
name: 'PerGB2018'
}
}
}
param appInsightsName string = 'appinsights${take(uniqueString(resourceGroup().id), 5)}'
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
name: appInsightsName
location: location
kind: 'web'
properties: {
Application_Type: 'web'
WorkspaceResourceId: workspace.id
}
}
param loggerName string = 'log${take(uniqueString(resourceGroup().id), 5)}'
resource logger 'Microsoft.ApiManagement/service/loggers@2022-08-01' = {
name: loggerName
parent: apiManagementService
properties: {
credentials: {
instrumentationKey: applicationInsights.properties.InstrumentationKey
}
loggerType: 'applicationInsights'
}
}
param diagnosticName string = 'applicationinsights'
resource diagnostic 'Microsoft.ApiManagement/service/diagnostics@2022-08-01' = {
name: diagnosticName
parent: apiManagementService
properties: {
loggerId: logger.id
}
}
param policyName string = 'policy'
resource apiPolicy 'Microsoft.ApiManagement/service/apis/policies@2022-08-01' = {
name: policyName
parent: api
properties: {
format: 'rawxml'
value: loadTextContent('./ApiManagementPolicy.xml')
}
}

Просмотреть файл

@ -0,0 +1,63 @@
<!-- Policy configuration for the API. Explore other sample policies at https://learn.microsoft.com/en-us/azure/api-management/policies/ -->
<policies>
<inbound>
<base />
<!-- This policy is needed to handle preflight requests using the OPTIONS method. Learn more at https://learn.microsoft.com/en-us/azure/api-management/api-management-cross-domain-policies -->
<cors allow-credentials="false">
<allowed-origins>
<origin>*</origin>
</allowed-origins>
<allowed-methods>
<method>PUT</method>
<method>GET</method>
<method>POST</method>
<method>DELETE</method>
<method>PATCH</method>
</allowed-methods>
<allowed-headers>
<header>*</header>
</allowed-headers>
<expose-headers>
<header>*</header>
</expose-headers>
</cors>
</inbound>
<backend>
<limit-concurrency key="@(context.Request.IpAddress)" max-count="3">
<forward-request timeout="120" />
</limit-concurrency>
</backend>
<outbound>
<base />
<!-- Optional policy to to send custom metrics to Application Insights. Learn more at https://learn.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#emit-metrics -->
<choose>
<when condition="@(context.Response.StatusCode &gt;= 200 &amp;&amp; context.Response.StatusCode &lt; 300)">
<emit-metric name="Successful requests" value="1" namespace="apim-metrics">
<dimension name="API" value="@(context.Api.Name)" />
<dimension name="Client IP" value="@(context.Request.IpAddress)" />
<dimension name="Status Code" value="@((String)context.Response.StatusCode.ToString())" />
<dimension name="Status Reason" value="@(context.Response.StatusReason)" />
</emit-metric>
</when>
<when condition="@(context.Response.StatusCode &gt;= 400 &amp;&amp; context.Response.StatusCode &lt; 600)">
<emit-metric name="Failed requests" value="1" namespace="apim-metrics">
<dimension name="API" value="@(context.Api.Name)" />
<dimension name="Client IP" value="@(context.Request.IpAddress)" />
<dimension name="Status Code" value="@(context.Response.StatusCode.ToString())" />
<dimension name="Status Reason" value="@(context.Response.StatusReason)" />
<dimension name="Error Source" value="backend" />
</emit-metric>
</when>
</choose>
</outbound>
<on-error>
<base />
<emit-metric name="Failed requests" value="1" namespace="apim-metrics">
<dimension name="API" value="@(context.Api.Name)" />
<dimension name="Client IP" value="@(context.Request.IpAddress)" />
<dimension name="Status Code" value="500" />
<dimension name="Status Reason" value="@(context.LastError.Reason)" />
<dimension name="Error Source" value="gateway" />
</emit-metric>
</on-error>
</policies>

Просмотреть файл

@ -0,0 +1,51 @@
# How To Run ApiManagement.Tests.ps1
`ApiManagement.Tests.ps1` contains examples of using the `Confirm-AzBPApiManagement`, `Confirm-AzBPApiManagementApi`,
`Confirm-AzBPApiManagementDiagnostic`, `Confirm-AzBPApiManagementLogger`, and `Confirm-AzBPApiManagementPolicy`
cmdlets.
## Pre-Requisites
- Follow the [setup instructions](../README.md)
## Steps
1. Navigate to ApiManagement directory:
```Powershell
cd examples\ApiManagement\
```
1. Deploy the Api Management Service to your resource group:
```Powershell
New-AzResourceGroupDeployment -ResourceGroupName "<your-resource-group-name>"`
-TemplateFile ".\ApiManagement.bicep"
```
1. Update `ApiManagement.Tests.ps1` variables to point to your expected resources:
- `rg-test` -> `your-resource-group-name`
- `servicetest` -> `your-api-management-service-name`
- `apitest` -> `your-api-management-api-name`
- `diagtest` -> `your-api-management-diagnostic-name`
- `loggertest` -> `your-api-managemetn-logger-name`
- `westus` -> `your-resource-group-location`
1. If using a local copy of `Az.InfrastructureTesting`, replace `Import-Module Az.InfrastructureTesting` with
`Import-Module "../../bin/BenchPress.Azure.psd1"`.
1. Run `ApiManagement.Tests.ps1`:
```Powershell
Invoke-Pester -Path .\ApiManagement.Tests.ps1
```
1. Success!
```Powershell
Tests completed in 20.02s
Tests Passed: 29, Failed: 0, Skipped: 0 NotRun: 0
```
1. Don't forget to delete any deployed resources that are no longer needed.

Просмотреть файл

@ -88,6 +88,6 @@ Describe 'Verify App Insights' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -87,6 +87,6 @@ Describe 'Verify App Service Plan' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -23,6 +23,6 @@ Describe 'Spin up , Tear down Action Group' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -32,7 +32,7 @@ Describe 'Verify Resource Exists' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -0,0 +1,69 @@
BeforeAll {
Import-Module Az.InfrastructureTesting
$Script:rgName = 'rg-test'
$Script:conAppName = 'conAppBenchPressTest'
$Script:location = 'westus3'
}
Describe 'Verify Container Application' {
BeforeAll {
$Script:noContainerAppName = 'nocontainerapp'
}
It "Should contain a Container Application named $conAppName - Confirm-AzBPResource" {
$params = @{
ResourceType = "ContainerApp"
ResourceName = $conAppName
ResourceGroupName = $rgName
}
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain a Container Application with an Ingress Port of 80 - Confirm-AzBPResource" {
$params = @{
ResourceType = "ContainerApp"
ResourceName = $conAppName
ResourceGroupName = $rgName
PropertyKey = "IngressTargetPort"
PropertyValue = 80
}
(Confirm-AzBPResource @params).Success | Should -Be $true
}
It "Should contain a Container Application named $conAppName" {
(Confirm-AzBPContainerApp -ResourceGroupName $rgName -Name $conAppName).Success | Should -Be $true
}
It "Should not contain a Container Application named $noContainerAppName" {
# The '-ErrorAction SilentlyContinue' command suppresses all errors.
# In this test, it will suppress the error message when a resource cannot be found.
# Remove this field to see all errors.
$params = @{
ResourceGroupName = $rgName
Name = $noContainerAppName
ErrorAction = 'SilentlyContinue'
}
(Confirm-AzBPContainerApp @params).Success | Should -Be $false
}
It "Should contain a Container Application named $conAppName" {
Confirm-AzBPContainerApp -ResourceGroupName $rgName -Name $conAppName | Should -BeDeployed
}
It "Should contain a Container Application named $conAppName in $location" {
Confirm-AzBPContainerApp -ResourceGroupName $rgName -Name $conAppName | Should -BeInLocation $location
}
It "Should contain a Container Application named $conAppName in $rgName" {
Confirm-AzBPContainerApp -ResourceGroupName $rgName -Name $conAppName | Should -BeInResourceGroup $rgName
}
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -0,0 +1,47 @@
# How To Run ContainerApp.Tests.ps1
`ContainerApp.Tests.ps1` contains examples of using the `Confirm-AzBPContainerApp` cmdlet.
## Pre-Requisites
- Follow the [setup instructions](../README.md)
## Steps
1. Navigate to ContainerApp directory:
```Powershell
cd examples\ContainerApp\
```
1. Deploy the Container Registry to your resource group:
```Powershell
New-AzResourceGroupDeployment -ResourceGroupName "<your-resource-group-name>"`
-TemplateFile ".\containerApp.bicep"
```
1. Update `ContainerApp.Tests.ps1` variables to point to your expected resources:
- `rg-test` -> `your-resource-group-name`
- `conAppBenchPressTest` -> `your-container-application-name`
- `westus3` -> `your-resource-group-location-name`
1. If using a local copy of `Az.InfrastructureTesting`, replace `Import-Module Az.InfrastructureTesting` with
`Import-Module "../../bin/BenchPress.Azure.psd1"`. Note that the final `AfterAll` step will properly remove the module
regardless of which method is chosen to load the module.
1. Run `ContainerApp.Tests.ps1`:
```Powershell
Invoke-Pester -Path .\ContainerApp.Tests.ps1
```
1. Success!
```Powershell
Tests completed in 5.02s
Tests Passed: 7, Failed: 0, Skipped: 0 NotRun: 0
```
1. Don't forget to delete any deployed resources that are no longer needed.

Просмотреть файл

@ -0,0 +1,69 @@
param containerAppName string = 'acr${take(uniqueString(resourceGroup().id), 5)}'
param location string = resourceGroup().location
param targetPort int = 80
param containerImage string = 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: 'loganalytics${containerAppName}'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
}
}
resource containerAppEnv 'Microsoft.App/managedEnvironments@2022-10-01' = {
name: 'env${containerAppName}'
location: location
sku: {
name: 'Consumption'
}
properties: {
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: logAnalytics.properties.customerId
sharedKey: logAnalytics.listKeys().primarySharedKey
}
}
}
}
resource containerApp 'Microsoft.App/containerApps@2022-10-01' = {
name: containerAppName
location: location
properties: {
managedEnvironmentId: containerAppEnv.id
configuration: {
ingress: {
external: true
targetPort: targetPort
allowInsecure: false
traffic: [
{
latestRevision: true
weight: 100
}
]
}
}
template: {
revisionSuffix: 'firstrevision'
containers: [
{
name: containerAppName
image: containerImage
resources: {
cpu: json('0.5')
memory: '1Gi'
}
}
]
scale: {
minReplicas: 1
maxReplicas: 3
}
}
}
}

Просмотреть файл

@ -88,6 +88,6 @@ Describe 'Verify Container Registry' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -631,6 +631,6 @@ Describe 'Comsos DB SQL Database' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -159,6 +159,6 @@ Describe 'Verify Data Factory Linked Service' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -333,6 +333,6 @@ Describe 'Verify EventHub Consumer Group' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -123,6 +123,6 @@ Describe 'Verify KeyVault' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -93,6 +93,6 @@ Describe 'Verify Operational Insights Workspace Exists' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -78,6 +78,6 @@ Describe 'Verify Resource Group Exists' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -92,6 +92,6 @@ Describe 'Verify Sql Database' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -89,6 +89,6 @@ Describe 'Verify Sql Server' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -178,6 +178,6 @@ Describe 'Verify Storage Container' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -409,6 +409,6 @@ Describe 'Stream Analytics Jobs' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -288,6 +288,6 @@ Describe 'Verify Synapse Spark/SQL Pool' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -95,6 +95,6 @@ Describe 'Verify Virtual Machine' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}

Просмотреть файл

@ -88,6 +88,6 @@ Describe 'Verify Web App Exists' {
}
AfterAll {
Get-Module Az-InfrastructureTesting | Remove-Module
Get-Module Az.InfrastructureTesting | Remove-Module
Get-Module BenchPress.Azure | Remove-Module
}