benchpress/examples/OperationalInsightsWorkspace/OperationalInsightsWorkspac...

1.4 KiB

How To Run OperationalInsightsWorkspace.Tests.ps1

OperationalInsightsWorkspace.Tests.ps1 contains examples of using the Confirm-AzBPOperationalInsightsWorkspace cmdlet.

Pre-Requisites

Steps

  1. Navigate to OperationalInsightsWorkspace directory:

    cd examples/OperationalInsightsWorkspace/
    
  2. Deploy the Operational Insights Workspace to your subscription:

     New-AzResourceGroupDeployment -TemplateFile "./operationalInsightsWorkspace.bicep" `
     -Location "WestUS3"
    
  3. Update OperationalInsightsWorkspace.Tests.ps1 variables to point to your expected resources:

    • rg-test -> your-resource-group-name
    • oiwName -> your-operational-insights-workspace-name
    • westus3 -> your-operational-insights-location
  4. If using a local copy of BenchPress.Azure, replace Import-Module BenchPress.Azure 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.

  5. Run OperationalInsightsWorkspace.Tests.ps1:

    Invoke-Pester -Path ./OperationalInsightsWorkspace.Tests.ps1
    
  6. Success!

    Tests completed in 952ms
    Tests Passed: 2, Failed: 0, Skipped: 0 NotRun: 0
    
  7. Don't forget to delete any deployed resources that are no longer needed.