From 7cebf5de9e68eca398d00d58ab893bca4473a57b Mon Sep 17 00:00:00 2001 From: Kaushal Kumar Date: Mon, 22 Aug 2022 07:39:38 +0530 Subject: [PATCH] Network Security Perimeter Resources (#19164) * temp commit * delete base nsp added * Add delete base profile * make nspdelbase1 as parent of 1 association and 2 accessRukes * add association in del base2 profile and nsp base1, profile3 -> profile base 2 * variable name fix * add all values in env * add test for get and remove * create profile add test case * Add test cases for create access rule, associations * temp commit, comment our association delete, rg delete commands * update utils * Update works woth asking parameters * filename update * try multiple commands * Update works * Add update associaton, access rule * update * update * Add access rule test cases * Add fqdn test cases * association update * update * Add GetViaIdentity test cases * add examples in docs * Add examples * remove python file * update examples * subscription id and resource group change in docs and examples * Add github swagger url * Add access rule with perimeter docs * Add test recordings * cleanups * Cleanups * Check if association is deleted, cleanups * review changes * move the nsp files one directory up as per review comments * moved it to one directory up * Access rule bug fix, test case update * singular plural parameter pipeline validation fix * cleanup swagger, regenerate ps cmdlets, modify paramters Co-authored-by: Kaushal Kumar --- .../.gitattributes | 1 + .../.gitignore | 16 + .../Az.NetworkSecurityPerimeter.psd1 | 24 + .../README.md | 219 +++++ .../custom/README.md | 41 + ...e-AzNetworkSecurityPerimeterAccessRule.ps1 | 235 +++++ ...-AzNetworkSecurityPerimeterAssociation.ps1 | 215 +++++ .../docs/Az.NetworkSecurityPerimeter.md | 55 ++ .../docs/Get-AzNetworkSecurityPerimeter.md | 236 +++++ ...et-AzNetworkSecurityPerimeterAccessRule.md | 265 +++++ ...t-AzNetworkSecurityPerimeterAssociation.md | 251 +++++ .../Get-AzNetworkSecurityPerimeterProfile.md | 251 +++++ .../docs/New-AzNetworkSecurityPerimeter.md | 286 ++++++ ...ew-AzNetworkSecurityPerimeterAccessRule.md | 423 ++++++++ ...w-AzNetworkSecurityPerimeterAssociation.md | 335 +++++++ .../New-AzNetworkSecurityPerimeterProfile.md | 301 ++++++ .../docs/README.md | 11 + .../docs/Remove-AzNetworkSecurityPerimeter.md | 206 ++++ ...ve-AzNetworkSecurityPerimeterAccessRule.md | 237 +++++ ...e-AzNetworkSecurityPerimeterAssociation.md | 252 +++++ ...emove-AzNetworkSecurityPerimeterProfile.md | 222 +++++ ...te-AzNetworkSecurityPerimeterAccessRule.md | 386 ++++++++ ...e-AzNetworkSecurityPerimeterAssociation.md | 329 +++++++ .../Get-AzNetworkSecurityPerimeter.md | 59 ++ ...et-AzNetworkSecurityPerimeterAccessRule.md | 52 + ...t-AzNetworkSecurityPerimeterAssociation.md | 53 + .../Get-AzNetworkSecurityPerimeterProfile.md | 58 ++ .../New-AzNetworkSecurityPerimeter.md | 33 + ...ew-AzNetworkSecurityPerimeterAccessRule.md | 46 + ...w-AzNetworkSecurityPerimeterAssociation.md | 18 + .../New-AzNetworkSecurityPerimeterProfile.md | 33 + .../Remove-AzNetworkSecurityPerimeter.md | 18 + ...ve-AzNetworkSecurityPerimeterAccessRule.md | 20 + ...e-AzNetworkSecurityPerimeterAssociation.md | 18 + ...emove-AzNetworkSecurityPerimeterProfile.md | 20 + ...te-AzNetworkSecurityPerimeterAccessRule.md | 36 + ...e-AzNetworkSecurityPerimeterAssociation.md | 33 + .../how-to.md | 58 ++ .../license.txt | 227 +++++ .../resources/README.md | 11 + ...-AzNetworkSecurityPerimeter.Recording.json | 166 ++++ .../Get-AzNetworkSecurityPerimeter.Tests.ps1 | 36 + ...SecurityPerimeterAccessRule.Recording.json | 166 ++++ ...tworkSecurityPerimeterAccessRule.Tests.ps1 | 41 + ...ecurityPerimeterAssociation.Recording.json | 166 ++++ ...workSecurityPerimeterAssociation.Tests.ps1 | 45 + ...orkSecurityPerimeterProfile.Recording.json | 166 ++++ ...zNetworkSecurityPerimeterProfile.Tests.ps1 | 43 + ...-AzNetworkSecurityPerimeter.Recording.json | 38 + .../New-AzNetworkSecurityPerimeter.Tests.ps1 | 26 + ...SecurityPerimeterAccessRule.Recording.json | 74 ++ ...tworkSecurityPerimeterAccessRule.Tests.ps1 | 36 + ...ecurityPerimeterAssociation.Recording.json | 38 + ...workSecurityPerimeterAssociation.Tests.ps1 | 28 + ...orkSecurityPerimeterProfile.Recording.json | 38 + ...zNetworkSecurityPerimeterProfile.Tests.ps1 | 25 + .../test/NspTemplate.json | 902 ++++++++++++++++++ .../test/README.md | 17 + ...-AzNetworkSecurityPerimeter.Recording.json | 123 +++ ...emove-AzNetworkSecurityPerimeter.Tests.ps1 | 34 + ...SecurityPerimeterAccessRule.Recording.json | 122 +++ ...tworkSecurityPerimeterAccessRule.Tests.ps1 | 36 + ...ecurityPerimeterAssociation.Recording.json | 121 +++ ...workSecurityPerimeterAssociation.Tests.ps1 | 35 + ...orkSecurityPerimeterProfile.Recording.json | 123 +++ ...zNetworkSecurityPerimeterProfile.Tests.ps1 | 36 + ...SecurityPerimeterAccessRule.Recording.json | 315 ++++++ ...tworkSecurityPerimeterAccessRule.Tests.ps1 | 50 + ...ecurityPerimeterAssociation.Recording.json | 238 +++++ ...workSecurityPerimeterAssociation.Tests.ps1 | 41 + .../test/env.json | 42 + .../test/loadEnv.ps1 | 29 + .../test/localEnv.json | 42 + .../test/utils.ps1 | 227 +++++ .../utils/Unprotect-SecureString.ps1 | 16 + 75 files changed, 9271 insertions(+) create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/.gitattributes create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/.gitignore create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/Az.NetworkSecurityPerimeter.psd1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/README.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/custom/README.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAccessRule.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAssociation.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Az.NetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterProfile.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterProfile.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/README.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterProfile.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterProfile.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterProfile.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeter.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterProfile.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAccessRule.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAssociation.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/how-to.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/license.txt create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/resources/README.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/NspTemplate.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/README.md create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Recording.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Tests.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/env.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/loadEnv.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/localEnv.json create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/test/utils.ps1 create mode 100644 src/Network/NetworkSecurityPerimeter.Autorest/utils/Unprotect-SecureString.ps1 diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/.gitattributes b/src/Network/NetworkSecurityPerimeter.Autorest/.gitattributes new file mode 100644 index 000000000000..2125666142eb --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/.gitignore b/src/Network/NetworkSecurityPerimeter.Autorest/.gitignore new file mode 100644 index 000000000000..3c3d57339c8b --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/.gitignore @@ -0,0 +1,16 @@ +bin +obj +.vs +generated +internal +exports +tools +custom/*.psm1 +custom/autogen-model-cmdlets +test/*-TestResults.xml +/*.ps1 +/*.ps1xml +/*.psm1 +/*.snk +/*.csproj +/*.nuspec \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/Az.NetworkSecurityPerimeter.psd1 b/src/Network/NetworkSecurityPerimeter.Autorest/Az.NetworkSecurityPerimeter.psd1 new file mode 100644 index 000000000000..bac10d44f5de --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/Az.NetworkSecurityPerimeter.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = '9560a0c7-e4ed-40d0-a8c4-9b28b241edca' + RootModule = './Az.NetworkSecurityPerimeter.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: NetworkSecurityPerimeter cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.NetworkSecurityPerimeter.private.dll' + FormatsToProcess = './Az.NetworkSecurityPerimeter.format.ps1xml' + FunctionsToExport = 'Get-AzNetworkSecurityPerimeter', 'Get-AzNetworkSecurityPerimeterAccessRule', 'Get-AzNetworkSecurityPerimeterAssociation', 'Get-AzNetworkSecurityPerimeterProfile', 'New-AzNetworkSecurityPerimeter', 'New-AzNetworkSecurityPerimeterAccessRule', 'New-AzNetworkSecurityPerimeterAssociation', 'New-AzNetworkSecurityPerimeterProfile', 'Remove-AzNetworkSecurityPerimeter', 'Remove-AzNetworkSecurityPerimeterAccessRule', 'Remove-AzNetworkSecurityPerimeterAssociation', 'Remove-AzNetworkSecurityPerimeterProfile', 'Update-AzNetworkSecurityPerimeterAccessRule', 'Update-AzNetworkSecurityPerimeterAssociation', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'NetworkSecurityPerimeter' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/README.md b/src/Network/NetworkSecurityPerimeter.Autorest/README.md new file mode 100644 index 000000000000..afa47f5ddcab --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/README.md @@ -0,0 +1,219 @@ + +# Az.NetworkSecurityPerimeter +This directory contains the PowerShell module for the NetworkSecurityPerimeter service. + +--- +## Status +[![Az.NetworkSecurityPerimeter](https://img.shields.io/powershellgallery/v/Az.NetworkSecurityPerimeter.svg?style=flat-square&label=Az.NetworkSecurityPerimeter "Az.NetworkSecurityPerimeter")](https://www.powershellgallery.com/packages/Az.NetworkSecurityPerimeter/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.NetworkSecurityPerimeter`, see [how-to.md](how-to.md). + + +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: +# readme.azure.noprofile.md is the common configuration file +# - ../../../../tools/SwaggerCI/readme.azure.noprofile.md + - $(this-folder)/../../readme.azure.noprofile.md +input-file: +# You need to specify your swagger files here. + - https://github.com/kaushal087/azure-rest-api-specs/blob/8afd9a7cf174025c8d0cb9d8927e4efde1ccc047/specification/network/resource-manager/Microsoft.Network/preview/2021-02-01-preview/networkSecurityPerimeter.json +# - C:\repo\azure-rest-api-specs/specification/network/resource-manager/Microsoft.Network/preview/2021-02-01-preview/networkSecurityPerimeter.json +# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally +# - (this-folder)/relative-path-to-your-swagger + +# For new RP, the version is 0.1.0 +module-version: 0.1.0 +# Normally, title is the service name +title: NetworkSecurityPerimeter +subject-prefix: $(service-name) +sanitize-names: true + +# If there are post APIs for some kinds of actions in the RP, you may need to +# uncomment following line to support viaIdentity for these post APIs +# identity-correction-for-post: true + +directive: + # Following is two common directive which are normally required in all the RPs + # 1. Remove the unexpanded parameter set + # 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well +# - where: +# variant: ^Create$|^CreateViaIdentityExpanded$ +# remove: true +# Remove the set-* cmdlet + - where: + verb: Set + remove: true + - where: + variant: ^Update$|^UpdateViaIdentity$|^UpdateViaIdentityExpanded$ + remove: true + # Hide CreateViaIdentity for customization + - where: + variant: ^CreateViaIdentity$ + hide: true + - where: + subject: NetworkSecurityPerimeter + set: + subject-prefix: '' + - where: + subject: NspProfile + set: + subject: Profile + - where: + subject: NspAccessRule + set: + subject: AccessRule + - where: + subject: NspAssociation + set: + subject: Association + +# Parameter Update +# NSP + - where: + subject: NetworkSecurityPerimeter + parameter-name: Name + set: + alias: + - SecurityPerimeterName + - NSPName + + - where: + subject: NetworkSecurityPerimeter + parameter-name: Id + set: + parameter-name: SecurityPerimeterId + alias: + - Id + +# Profile + - where: + subject: Profile + parameter-name: ProfileName + set: + parameter-name: Name + alias: + - ProfileName + + - where: + subject: Profile + parameter-name: Id + set: + parameter-name: ProfileId + alias: + - Id + + - where: + subject: Profile + parameter-name: NetworkSecurityPerimeterName + set: + parameter-name: SecurityPerimeterName + alias: + - NetworkSecurityPerimeterName + - NSPName + +# AccessRule + - where: + subject: AccessRule + parameter-name: NetworkSecurityPerimeterName + set: + parameter-name: SecurityPerimeterName + alias: + - NetworkSecurityPerimeterName + - NSPName + + - where: + subject: AccessRule + parameter-name: Id + set: + parameter-name: AccessRuleId + alias: + - Id + + - where: + subject: AccessRule + parameter-name: ProfileName + set: + parameter-name: ProfileName + alias: + - SecurityPerimeterProfileName + - NSPProfileName + + - where: + subject: AccessRule + parameter-name: AccessRuleName + set: + parameter-name: Name + alias: + - AccessRuleName + + - where: + subject: AccessRule + parameter-name: NetworkSecurityPerimeter + set: + parameter-name: Perimeter + +# Association + - where: + subject: Association + parameter-name: NetworkSecurityPerimeterName + set: + parameter-name: SecurityPerimeterName + alias: + - NetworkSecurityPerimeterName + - NSPName + + - where: + subject: Association + parameter-name: ProfileName + set: + parameter-name: ProfileName + alias: + - SecurityPerimeterProfileName + - NSPProfileName + + - where: + subject: Association + parameter-name: AssociationName + set: + parameter-name: Name + alias: + - AssociationName + + - where: + subject: Association + parameter-name: Id + set: + parameter-name: AssociationId + alias: + - Id + +# feature request for the below change https://github.com/Azure/autorest.powershell/issues/982 + - from: source-file-csharp + where: $ + transform: $ = $.replace('if (result.NextLink != null)', 'if (result.NextLink != null && result.NextLink != "")') + + - from: source-file-csharp + where: $ + transform: $ = $.replace('_nextLink != null', '_nextLink != null && _nextLink != ""') + +``` diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/custom/README.md b/src/Network/NetworkSecurityPerimeter.Autorest/custom/README.md new file mode 100644 index 000000000000..0c4029b9e699 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/custom/README.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.NetworkSecurityPerimeter` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.NetworkSecurityPerimeter.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.NetworkSecurityPerimeter` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.NetworkSecurityPerimeter.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.NetworkSecurityPerimeter.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.NetworkSecurityPerimeter`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.NetworkSecurityPerimeter`. +- `Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.NetworkSecurityPerimeter`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAccessRule.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAccessRule.ps1 new file mode 100644 index 000000000000..952bd54e07a4 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAccessRule.ps1 @@ -0,0 +1,235 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates a workspace. +.Description +Updates a workspace. +#> +function Update-AzNetworkSecurityPerimeterAccessRule { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAccessRule])] + [CmdletBinding(DefaultParameterSetName = 'UpdateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + param( + + #Runtime paramters + + [Parameter(HelpMessage = "Run the command as a job")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(HelpMessage = "Run the command asynchronously")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + + # Azure parameters + + [Parameter(HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + + #Path parameters + + [Parameter(ParameterSetName = 'UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline, HelpMessage = "Identity parameter. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName = 'UpdateExpanded', HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the access rule.")] + [Alias('AccessRuleName')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the access rule. + ${Name}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the network security perimeter")] + [Alias('NetworkSecurityPerimeterName')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the network security perimeter. + ${SecurityPerimeterName}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the profile")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the profile. + ${ProfileName}, + + + # Body paramters + + [Parameter(HelpMessage = "Resource tags.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.IResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(HelpMessage = "Location of the resource")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.String] + # The Location of the resource + ${Location}, + + [Parameter(HelpMessage = "Address Prefix")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.Collections.ArrayList] + # Address Prefix + ${AddressPrefix}, + + [Parameter(HelpMessage = "Fully qualified domain name")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.Collections.ArrayList] + # Fully qualified domain name + ${FullyQualifiedDomainName}, + + [Parameter(HelpMessage = "Inbound rule specified by the perimeter id")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.IPerimeterBasedAccessRule[]] + # Inbound rule specified by the perimeter id + ${Perimeter}, + + [Parameter(HelpMessage = "Direction")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.String] + # Direction + ${Direction}, + + [Parameter(HelpMessage = "Subscription ids")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.ISubscriptionId[]] + # Subscription ids + ${Subscription} + + # Add only those paramters which can be updated + + ) + + + + process { + try { + + # 1. GET + + # body params and AsJob + $bodyParams = 'Tag', 'Location', 'AddressPrefix', 'FullyQualifiedDomainName', 'Perimeter', 'Direction', 'Subscription', 'AsJob' + + $bodyParamsMap = @{} + + ForEach($bodyParam in $bodyParams){ + $bodyParamsMap[$bodyParam] = $PSBoundParameters.Remove($bodyParam) + } + + $null = $PSBoundParameters.Remove('WhatIf') + $null = $PSBoundParameters.Remove('Confirm') + + + $GETObject = Get-AzNetworkSecurityPerimeterAccessRule @PSBoundParameters + + # 2. PUT + + $pathParams = 'InputObject', 'ResourceGroupName', 'Name', 'SubscriptionId', 'SecurityPerimeterName', 'ProfileName' + + ForEach($pathParam in $pathParams){ + $null = $PSBoundParameters.Remove($pathParam) + } + + foreach ($item in $bodyParamsMap.GetEnumerator() ) + { + if ($item.Value){ + $key = $item.Key + + $variable = (Get-Variable $key -ValueOnly) + + $GETObject.$key = $variable + } + } + + # Call PUT method + New-AzNetworkSecurityPerimeterAccessRule_CreateViaIdentity -InputObject $GETObject -Parameter $GETObject @PSBoundParameters + + } + + catch { + throw + } + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAssociation.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAssociation.ps1 new file mode 100644 index 000000000000..236c91436d97 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/custom/Update-AzNetworkSecurityPerimeterAssociation.ps1 @@ -0,0 +1,215 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates an association +.Description +Updates an association. +#> +function Update-AzNetworkSecurityPerimeterAssociation { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAssociation])] + [CmdletBinding(DefaultParameterSetName = 'UpdateExpanded', PositionalBinding = $false, SupportsShouldProcess, ConfirmImpact = 'Medium')] + param( + + #Runtime paramters + + [Parameter(HelpMessage = "Run the command as a job")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(HelpMessage = "Run the command asynchronously")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials}, + + + # Azure parameters + + + [Parameter(HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + + #Path parameters + + [Parameter(ParameterSetName = 'UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline, HelpMessage = "Identity parameter. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName = 'UpdateExpanded', HelpMessage = "The ID of the target subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.DefaultInfo(Script = '(Get-AzContext).Subscription.Id')] + [System.String] + # The ID of the target subscription. + ${SubscriptionId}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the resource group. The name is case insensitive.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the resource group. + # The name is case insensitive. + ${ResourceGroupName}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the association.")] + [Alias('WorkspaceName')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the association. + ${Name}, + + [Parameter(ParameterSetName = 'UpdateExpanded', Mandatory, HelpMessage = "The name of the network security perimeter")] + [Alias('NetworkSecurityPerimeterName')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Path')] + [System.String] + # The name of the network security perimeter. + ${SecurityPerimeterName}, + + + # Body paramters + + [Parameter(HelpMessage = "Resource tags.")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Runtime.Info(PossibleTypes = ([Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.IResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter(HelpMessage = "Location of the resource")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.String] + # The Location of the resource + ${Location}, + + + [Parameter(HelpMessage = "Access Mode")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.String] + # Access Mode + ${AccessMode}, + + [Parameter(HelpMessage = "Private link resource id")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.String] + # Private link resource id + ${PrivateLinkResourceId}, + + [Parameter(HelpMessage = "Network security perimeter profile id")] + [Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Category('Body')] + [System.String] + # Network security perimeter profile id + ${ProfileId} + + ) + + process { + try { + + # 1. GET + + # body params and AsJob + $bodyParams = 'Tag', 'Location', 'AccessMode', 'PrivateLinkResourceId', 'ProfileId', 'AsJob' + + $bodyParamsMap = @{} + + ForEach($bodyParam in $bodyParams){ + $bodyParamsMap[$bodyParam] = $PSBoundParameters.Remove($bodyParam) + } + + $null = $PSBoundParameters.Remove('WhatIf') + $null = $PSBoundParameters.Remove('Confirm') + + $GETObject = Get-AzNetworkSecurityPerimeterAssociation @PSBoundParameters + + + # 2. PUT + + $pathParams = 'InputObject', 'ResourceGroupName', 'Name', 'SubscriptionId', 'SecurityPerimeterName' + + ForEach($pathParam in $pathParams){ + $null = $PSBoundParameters.Remove($pathParam) + } + + foreach ($item in $bodyParamsMap.GetEnumerator() ) + { + if ($item.Value){ + $key = $item.Key + + $variable = (Get-Variable $key -ValueOnly) + + $GETObject.$key = $variable + } + } + + + # Call PUT method + Az.NetworkSecurityPerimeter.private\New-AzNetworkSecurityPerimeterAssociation_CreateViaIdentity -InputObject $GETObject -Parameter $GETObject @PSBoundParameters + + } + catch { + throw + } + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Az.NetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Az.NetworkSecurityPerimeter.md new file mode 100644 index 000000000000..72f5bb8e9f70 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Az.NetworkSecurityPerimeter.md @@ -0,0 +1,55 @@ +--- +Module Name: Az.NetworkSecurityPerimeter +Module Guid: 9560a0c7-e4ed-40d0-a8c4-9b28b241edca +Download Help Link: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.NetworkSecurityPerimeter Module +## Description +Microsoft Azure PowerShell: NetworkSecurityPerimeter cmdlets + +## Az.NetworkSecurityPerimeter Cmdlets +### [Get-AzNetworkSecurityPerimeter](Get-AzNetworkSecurityPerimeter.md) +Gets the specified network security perimeter by the name. + +### [Get-AzNetworkSecurityPerimeterAccessRule](Get-AzNetworkSecurityPerimeterAccessRule.md) +Gets the specified NSP access rule by name. + +### [Get-AzNetworkSecurityPerimeterAssociation](Get-AzNetworkSecurityPerimeterAssociation.md) +Gets the specified NSP association by name. + +### [Get-AzNetworkSecurityPerimeterProfile](Get-AzNetworkSecurityPerimeterProfile.md) +Gets the specified NSP profile. + +### [New-AzNetworkSecurityPerimeter](New-AzNetworkSecurityPerimeter.md) +Creates or updates a Network Security Perimeter. + +### [New-AzNetworkSecurityPerimeterAccessRule](New-AzNetworkSecurityPerimeterAccessRule.md) +Creates or updates a network access rule. + +### [New-AzNetworkSecurityPerimeterAssociation](New-AzNetworkSecurityPerimeterAssociation.md) +Creates or updates a NSP resource association. + +### [New-AzNetworkSecurityPerimeterProfile](New-AzNetworkSecurityPerimeterProfile.md) +Creates or updates a network profile. + +### [Remove-AzNetworkSecurityPerimeter](Remove-AzNetworkSecurityPerimeter.md) +Deletes a network security perimeter. + +### [Remove-AzNetworkSecurityPerimeterAccessRule](Remove-AzNetworkSecurityPerimeterAccessRule.md) +Deletes an NSP access rule. + +### [Remove-AzNetworkSecurityPerimeterAssociation](Remove-AzNetworkSecurityPerimeterAssociation.md) +Deletes an NSP association resource. + +### [Remove-AzNetworkSecurityPerimeterProfile](Remove-AzNetworkSecurityPerimeterProfile.md) +Deletes an NSP profile. + +### [Update-AzNetworkSecurityPerimeterAccessRule](Update-AzNetworkSecurityPerimeterAccessRule.md) +Updates a workspace. + +### [Update-AzNetworkSecurityPerimeterAssociation](Update-AzNetworkSecurityPerimeterAssociation.md) +Updates an association + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeter.md new file mode 100644 index 000000000000..b07aa772db7f --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeter.md @@ -0,0 +1,236 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/get-aznetworksecurityperimeter +schema: 2.0.0 +--- + +# Get-AzNetworkSecurityPerimeter + +## SYNOPSIS +Gets the specified network security perimeter by the name. + +## SYNTAX + +### List (Default) +``` +Get-AzNetworkSecurityPerimeter -ResourceGroupName [-SubscriptionId ] [-SkipToken ] + [-Top ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzNetworkSecurityPerimeter -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzNetworkSecurityPerimeter -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Gets the specified network security perimeter by the name. + +## EXAMPLES + +### Example 1: List NetworkSecurityPerimeter +```powershell + + Get-AzNetworkSecurityPerimeter -ResourceGroupName ResourceGroup-1 + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp4 +eastus2euap nsp3 +eastus2euap nsp1 +eastus2euap nsp6 +eastus2euap nsp5 + + +``` + +List NetworkSecurityPerimeter + +### Example 2: Gets a NetworkSecurityPerimeter by Name +```powershell + + Get-AzNetworkSecurityPerimeter -Name nsp3 -ResourceGroupName ResourceGroup-1 + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp3 + + +``` + +Gets a NetworkSecurityPerimeter by Name + +### Example 3: Gets a NetworkSecurityPerimeter by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeter -Name nsp3 -ResourceGroupName ResourceGroup-1 + Get-AzNetworkSecurityPerimeter -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp3 + +``` + +Gets a NetworkSecurityPerimeter by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: NetworkSecurityPerimeterName, SecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +SkipToken is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Top +An optional query parameter which specifies the maximum number of records to be returned by the server. + +```yaml +Type: System.Int32 +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INetworkSecurityPerimeter + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..24bffdb2151c --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,265 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/get-aznetworksecurityperimeteraccessrule +schema: 2.0.0 +--- + +# Get-AzNetworkSecurityPerimeterAccessRule + +## SYNOPSIS +Gets the specified NSP access rule by name. + +## SYNTAX + +### List (Default) +``` +Get-AzNetworkSecurityPerimeterAccessRule -ProfileName -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-SkipToken ] [-Top ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzNetworkSecurityPerimeterAccessRule -Name -ProfileName -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzNetworkSecurityPerimeterAccessRule -InputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the specified NSP access rule by name. + +## EXAMPLES + +### Example 1: List NetworkSecurityPerimeterAccessRule +```powershell + + Get-AzNetworkSecurityPerimeterAccessRule -ProfileName profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + ar4 + ar3 + + +``` + +List NetworkSecurityPerimeterAccessRule + +### Example 2: Gets a NetworkSecurityPerimeterAccessRule by Name +```powershell + + Get-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ProfileName profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + ar3 + + +``` + +Gets a NetworkSecurityPerimeterAccessRule by Name + +### Example 3: Gets a NetworkSecurityPerimeterAccessRule by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ProfileName profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + Get-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- + ar3 + +``` + +Gets a NetworkSecurityPerimeterAccessRule by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the NSP access rule. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: AccessRuleName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProfileName +The name of the NSP profile. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: SecurityPerimeterProfileName, NSPProfileName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +SkipToken is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Top +An optional query parameter which specifies the maximum number of records to be returned by the server. + +```yaml +Type: System.Int32 +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAccessRule + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..9be1131096eb --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,251 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/get-aznetworksecurityperimeterassociation +schema: 2.0.0 +--- + +# Get-AzNetworkSecurityPerimeterAssociation + +## SYNOPSIS +Gets the specified NSP association by name. + +## SYNTAX + +### List (Default) +``` +Get-AzNetworkSecurityPerimeterAssociation -ResourceGroupName -SecurityPerimeterName + [-SubscriptionId ] [-SkipToken ] [-Top ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzNetworkSecurityPerimeterAssociation -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzNetworkSecurityPerimeterAssociation -InputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the specified NSP association by name. + +## EXAMPLES + +### Example 1: List NetworkSecurityPerimeterAccessAssociation +```powershell + + Get-AzNetworkSecurityPerimeterAssociation -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + association1 + association3 + + +``` + +List NetworkSecurityPerimeterAccessAssociation + +### Example 2: Gets a NetworkSecurityPerimeterAccessAssociation by Name +```powershell + + Get-AzNetworkSecurityPerimeterAssociation -Name association3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + association3 + + +``` + +Gets a NetworkSecurityPerimeterAccessAssociation by Name + +### Example 3: Gets a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name association3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + Get-AzNetworkSecurityPerimeterAssociation -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- + association3 + + +``` + +Gets a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the NSP association. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: AssociationName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +SkipToken is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Top +An optional query parameter which specifies the maximum number of records to be returned by the server. + +```yaml +Type: System.Int32 +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAssociation + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterProfile.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterProfile.md new file mode 100644 index 000000000000..b69c6c9e34cc --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Get-AzNetworkSecurityPerimeterProfile.md @@ -0,0 +1,251 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/get-aznetworksecurityperimeterprofile +schema: 2.0.0 +--- + +# Get-AzNetworkSecurityPerimeterProfile + +## SYNOPSIS +Gets the specified NSP profile. + +## SYNTAX + +### List (Default) +``` +Get-AzNetworkSecurityPerimeterProfile -ResourceGroupName -SecurityPerimeterName + [-SubscriptionId ] [-SkipToken ] [-Top ] [-DefaultProfile ] + [] +``` + +### Get +``` +Get-AzNetworkSecurityPerimeterProfile -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzNetworkSecurityPerimeterProfile -InputObject + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets the specified NSP profile. + +## EXAMPLES + +### Example 1: Gets a NetworkSecurityPerimeterProfile by Name +```powershell + + Get-AzNetworkSecurityPerimeterProfile -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 +eastus2euap profile2 + + +``` + +Lists NetworkSecurityPerimeterProfile + +### Example 2: Gets a NetworkSecurityPerimeterProfile by Name +```powershell + + Get-AzNetworkSecurityPerimeterProfile -Name profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 + + +``` + +Gets a NetworkSecurityPerimeterProfile by Name + +### Example 3: Gets a NetworkSecurityPerimeterProfile by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterProfile -Name profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + Get-AzNetworkSecurityPerimeterProfile -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 + + +``` + +Gets a NetworkSecurityPerimeterProfile by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the NSP profile. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: ProfileName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkipToken +SkipToken is only used if a previous operation returned a partial result. +If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls. + +```yaml +Type: System.String +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Top +An optional query parameter which specifies the maximum number of records to be returned by the server. + +```yaml +Type: System.Int32 +Parameter Sets: List +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspProfile + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeter.md new file mode 100644 index 000000000000..be8eb179bc83 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeter.md @@ -0,0 +1,286 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/new-aznetworksecurityperimeter +schema: 2.0.0 +--- + +# New-AzNetworkSecurityPerimeter + +## SYNOPSIS +Creates or updates a Network Security Perimeter. + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzNetworkSecurityPerimeter -Name -ResourceGroupName [-SubscriptionId ] + [-Location ] [-SecurityPerimeterId ] [-Tag ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +### Create +``` +New-AzNetworkSecurityPerimeter -Name -ResourceGroupName + -Parameter [-SubscriptionId ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### CreateViaIdentityExpanded +``` +New-AzNetworkSecurityPerimeter -InputObject [-Location ] + [-SecurityPerimeterId ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Creates or updates a Network Security Perimeter. + +## EXAMPLES + +### Example 1: Creates a NetworkSecurityPerimeter +```powershell + + New-AzNetworkSecurityPerimeter -ResourceGroupName ResourceGroup-1 -Name nsp1 -Location eastus2euap + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp1 + + +``` + +Creates a NetworkSecurityPerimeter + +### Example 2: Creates a NetworkSecurityPerimeter +```powershell + + New-AzNetworkSecurityPerimeter -ResourceGroupName ResourceGroup-1 -Name nsp2 -Location eastus2euap + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp2 + + +``` + +Creates a NetworkSecurityPerimeter + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: CreateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +Resource location. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: NetworkSecurityPerimeterName, SecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Parameter +The Network Security Perimeter resource +To construct, see NOTES section for PARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INetworkSecurityPerimeter +Parameter Sets: Create +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterId +Resource ID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: Id + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INetworkSecurityPerimeter + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INetworkSecurityPerimeter + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +`PARAMETER `: The Network Security Perimeter resource + - `[Id ]`: Resource ID. + - `[Location ]`: Resource location. + - `[Tag ]`: Resource tags. + - `[(Any) ]`: This indicates any property can be added to this object. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..09e9504ce623 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,423 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/new-aznetworksecurityperimeteraccessrule +schema: 2.0.0 +--- + +# New-AzNetworkSecurityPerimeterAccessRule + +## SYNOPSIS +Creates or updates a network access rule. + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzNetworkSecurityPerimeterAccessRule -Name -ProfileName -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-AccessRuleId ] + [-AddressPrefix ] [-Direction ] [-FullyQualifiedDomainName ] + [-Location ] [-Perimeter ] [-Subscription ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### Create +``` +New-AzNetworkSecurityPerimeterAccessRule -Name -ProfileName -ResourceGroupName + -SecurityPerimeterName -Parameter [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityExpanded +``` +New-AzNetworkSecurityPerimeterAccessRule -InputObject + [-AccessRuleId ] [-AddressPrefix ] [-Direction ] + [-FullyQualifiedDomainName ] [-Location ] [-Perimeter ] + [-Subscription ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Creates or updates a network access rule. + +## EXAMPLES + +### Example 1: Creates a NetworkSecurityPerimeterAccessRule +```powershell + + New-AzNetworkSecurityPerimeterAccessRule -Name accessRule1 -ProfileName profile2 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 -AddressPrefix '10.10.0.0/16' -Direction 'Inbound' -Location eastus2euap + +``` + +```output + +Location Name +-------- ---- + accessRule1 + + +``` + +Creates a NetworkSecurityPerimeterAccessRule + +### Example 2: Creates a NetworkSecurityPerimeterAccessRule +```powershell + +$perimeter1 = @{ + id='/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.Network/networkSecurityPerimeters/kaushal-nsp1' + perimeterGuid='' + location='eastus2euap' +} + +$perimeter2 = @{ + id='/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.Network/networkSecurityPerimeters/kk-nsp4' + perimeterGuid='bcf8bf02-8b8a-4bcb-933d-2b575d94ec8f' + location='eastus2euap' +} + +$networkSecurityPerimeters = @($perimeter1,$perimeter2) + +New-AzNetworkSecurityPerimeterAccessRule -Name 'perimeter-ar' -SecurityPerimeterName 'testt-nsp1' -ProfileName 't-profile2' -ResourceGroupName 'ResourceGroup-1' -Direction 'Inbound' -Location 'eastus2euap' -NetworkSecurityPerimeters $networkSecurityPerimeters + +``` + +```output + +Location Name +-------- ---- + perimeter_ar + +``` + +Creates a NetworkSecurityPerimeterAccessRule + +## PARAMETERS + +### -AccessRuleId +Resource ID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: Id + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AddressPrefix +Inbound address prefixes (IPv4/IPv6) + +```yaml +Type: System.String[] +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Direction +Direction that specifies whether the access rules is inbound/outbound. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Support.AccessRuleDirection +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FullyQualifiedDomainName +Outbound rules fully qualified domain name format. + +```yaml +Type: System.String[] +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: CreateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +Resource location. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the NSP access rule. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: AccessRuleName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Parameter +The NSP access rule resource +To construct, see NOTES section for PARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAccessRule +Parameter Sets: Create +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Perimeter +Inbound rule specified by the perimeter id. +To construct, see NOTES section for PERIMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.IPerimeterBasedAccessRule[] +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProfileName +The name of the NSP profile. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: SecurityPerimeterProfileName, NSPProfileName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Subscription +List of subscription ids +To construct, see NOTES section for SUBSCRIPTION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.ISubscriptionId[] +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAccessRule + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAccessRule + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +`PARAMETER `: The NSP access rule resource + - `[Id ]`: Resource ID. + - `[Location ]`: Resource location. + - `[Tag ]`: Resource tags. + - `[(Any) ]`: This indicates any property can be added to this object. + - `[AddressPrefix ]`: Inbound address prefixes (IPv4/IPv6) + - `[Direction ]`: Direction that specifies whether the access rules is inbound/outbound. + - `[FullyQualifiedDomainName ]`: Outbound rules fully qualified domain name format. + - `[NetworkSecurityPerimeter ]`: Inbound rule specified by the perimeter id. + - `[Id ]`: NSP id in the ARM id format. + - `[Subscription ]`: List of subscription ids + - `[Id ]`: Subscription id in the ARM id format. + +`PERIMETER `: Inbound rule specified by the perimeter id. + - `[Id ]`: NSP id in the ARM id format. + +`SUBSCRIPTION `: List of subscription ids + - `[Id ]`: Subscription id in the ARM id format. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..ed028762f278 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,335 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/new-aznetworksecurityperimeterassociation +schema: 2.0.0 +--- + +# New-AzNetworkSecurityPerimeterAssociation + +## SYNOPSIS +Creates or updates a NSP resource association. + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzNetworkSecurityPerimeterAssociation -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-AccessMode ] + [-AssociationId ] [-Location ] [-PrivateLinkResourceId ] [-ProfileId ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### Create +``` +New-AzNetworkSecurityPerimeterAssociation -Name -ResourceGroupName + -SecurityPerimeterName -Parameter [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityExpanded +``` +New-AzNetworkSecurityPerimeterAssociation -InputObject + [-AccessMode ] [-AssociationId ] [-Location ] + [-PrivateLinkResourceId ] [-ProfileId ] [-Tag ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Creates or updates a NSP resource association. + +## EXAMPLES + +### Example 1: Creates a NetworkSecurityPerimeterAccessAssociation +```powershell + + $profileId = '/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.Network/networkSecurityPerimeters/nsp3/profiles/profile2' + $privateLinkResourceId = '/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.KeyVault/vaults/rp4' + New-AzNetworkSecurityPerimeterAssociation -Name association1 -SecurityPerimeterName nsp3 -ResourceGroupName ResourceGroup-1 -Location eastus2euap -AccessMode Learning -ProfileId $profileId -PrivateLinkResourceId $privateLinkResourceId + +``` + +```output + +Location Name +-------- ---- + association1 + + +``` + +Creates a NetworkSecurityPerimeterAccessAssociation + +## PARAMETERS + +### -AccessMode +Access mode on the association. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Support.AssociationAccessMode +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AssociationId +Resource ID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: Id + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: CreateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +Resource location. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the NSP association. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: AssociationName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Parameter +The NSP resource association resource +To construct, see NOTES section for PARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAssociation +Parameter Sets: Create +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -PrivateLinkResourceId +Resource ID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProfileId +Resource ID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAssociation + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAssociation + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +`PARAMETER `: The NSP resource association resource + - `[Id ]`: Resource ID. + - `[Location ]`: Resource location. + - `[Tag ]`: Resource tags. + - `[(Any) ]`: This indicates any property can be added to this object. + - `[AccessMode ]`: Access mode on the association. + - `[PrivateLinkResourceId ]`: Resource ID. + - `[ProfileId ]`: Resource ID. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterProfile.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterProfile.md new file mode 100644 index 000000000000..b68b8670f6db --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/New-AzNetworkSecurityPerimeterProfile.md @@ -0,0 +1,301 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/new-aznetworksecurityperimeterprofile +schema: 2.0.0 +--- + +# New-AzNetworkSecurityPerimeterProfile + +## SYNOPSIS +Creates or updates a network profile. + +## SYNTAX + +### CreateExpanded (Default) +``` +New-AzNetworkSecurityPerimeterProfile -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-Location ] [-ProfileId ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### Create +``` +New-AzNetworkSecurityPerimeterProfile -Name -ResourceGroupName + -SecurityPerimeterName -Parameter [-SubscriptionId ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### CreateViaIdentityExpanded +``` +New-AzNetworkSecurityPerimeterProfile -InputObject [-Location ] + [-ProfileId ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Creates or updates a network profile. + +## EXAMPLES + +### Example 1: Creates a NetworkSecurityPerimeterProfile +```powershell + + New-AzNetworkSecurityPerimeterProfile -Name profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 + + +``` + +Creates a NetworkSecurityPerimeterProfile + +### Example 2: Creates a NetworkSecurityPerimeterProfile +```powershell + + New-AzNetworkSecurityPerimeterProfile -Name profile2 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile2 + + +``` + +Creates a NetworkSecurityPerimeterProfile + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: CreateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +Resource location. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the NSP profile. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: ProfileName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Parameter +The network security perimeter profile resource +To construct, see NOTES section for PARAMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspProfile +Parameter Sets: Create +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ProfileId +Resource ID. + +```yaml +Type: System.String +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: Id + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Create, CreateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: CreateExpanded, CreateViaIdentityExpanded +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspProfile + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspProfile + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +`PARAMETER `: The network security perimeter profile resource + - `[Id ]`: Resource ID. + - `[Location ]`: Resource location. + - `[Tag ]`: Resource tags. + - `[(Any) ]`: This indicates any property can be added to this object. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/README.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/README.md new file mode 100644 index 000000000000..6053a127b965 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/README.md @@ -0,0 +1,11 @@ +# Docs +This directory contains the documentation of the cmdlets for the `Az.NetworkSecurityPerimeter` module. To run documentation generation, use the `generate-help.ps1` script at the root module folder. Files in this folder will *always be overridden on regeneration*. To update documentation examples, please use the `..\examples` folder. + +## Info +- Modifiable: no +- Generated: all +- Committed: yes +- Packaged: yes + +## Details +The process of documentation generation loads `Az.NetworkSecurityPerimeter` and analyzes the exported cmdlets from the module. It recognizes the [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) that are generated into the scripts in the `..\exports` folder. Additionally, when writing custom cmdlets in the `..\custom` folder, you can use the help comments syntax, which decorate the exported scripts at build-time. The documentation examples are taken from the `..\examples` folder. \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeter.md new file mode 100644 index 000000000000..7aca2049b38d --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeter.md @@ -0,0 +1,206 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/remove-aznetworksecurityperimeter +schema: 2.0.0 +--- + +# Remove-AzNetworkSecurityPerimeter + +## SYNOPSIS +Deletes a network security perimeter. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzNetworkSecurityPerimeter -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzNetworkSecurityPerimeter -InputObject + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes a network security perimeter. + +## EXAMPLES + +### Example 1: Deletes a NetworkSecurityPerimeter by Name +```powershell + + Remove-AzNetworkSecurityPerimeter -Name nsp5 -ResourceGroupName ResourceGroup-1 + +``` + +Deletes a NetworkSecurityPerimeter by Name + +### Example 2: Deletes a NetworkSecurityPerimeter by identity (using pipe) +```powershell + + $nspObj = Get-AzNetworkSecurityPerimeter -Name nsp6 -ResourceGroupName ResourceGroup-1 + Remove-AzNetworkSecurityPerimeter -InputObject $nspObj + +``` + +Deletes a NetworkSecurityPerimeter by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: NetworkSecurityPerimeterName, SecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..298473603cd6 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,237 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/remove-aznetworksecurityperimeteraccessrule +schema: 2.0.0 +--- + +# Remove-AzNetworkSecurityPerimeterAccessRule + +## SYNOPSIS +Deletes an NSP access rule. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzNetworkSecurityPerimeterAccessRule -Name -ProfileName -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzNetworkSecurityPerimeterAccessRule -InputObject + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an NSP access rule. + +## EXAMPLES + +### Example 1: Deletes a NetworkSecurityPerimeterAccessRule by Name +```powershell + + Remove-AzNetworkSecurityPerimeterAccessRule -Name ar5 -ProfileName profile4 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + +``` + +Deletes a NetworkSecurityPerimeterAccessRule by Name + +### Example 2: Deletes a NetworkSecurityPerimeterAccessRule by identity (using pipe) +```powershell + + $accessRuleObj = Get-AzNetworkSecurityPerimeterAccessRule -Name ar6 -ProfileName profile4 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + Remove-AzNetworkSecurityPerimeterAccessRule -InputObject $accessRuleObj + +``` + +Deletes a NetworkSecurityPerimeterAccessRule by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the NSP access rule. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: AccessRuleName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProfileName +The name of the NSP profile. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: SecurityPerimeterProfileName, NSPProfileName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..18fed2567fdd --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,252 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/remove-aznetworksecurityperimeterassociation +schema: 2.0.0 +--- + +# Remove-AzNetworkSecurityPerimeterAssociation + +## SYNOPSIS +Deletes an NSP association resource. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzNetworkSecurityPerimeterAssociation -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzNetworkSecurityPerimeterAssociation -InputObject + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an NSP association resource. + +## EXAMPLES + +### Example 1: Deletes a NetworkSecurityPerimeterAccessAssociation by Name +```powershell + + Remove-AzNetworkSecurityPerimeterAssociation -Name association4 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + +``` + +Deletes a NetworkSecurityPerimeterAccessAssociation by Name + +### Example 2: Deletes a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) +```powershell + + $associationObj = Get-AzNetworkSecurityPerimeterAssociation -Name association5 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + Remove-AzNetworkSecurityPerimeterAssociation -InputObject $associationObj + +``` + +Deletes a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the NSP association. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: AssociationName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterProfile.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterProfile.md new file mode 100644 index 000000000000..2544aa56bfd9 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Remove-AzNetworkSecurityPerimeterProfile.md @@ -0,0 +1,222 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/remove-aznetworksecurityperimeterprofile +schema: 2.0.0 +--- + +# Remove-AzNetworkSecurityPerimeterProfile + +## SYNOPSIS +Deletes an NSP profile. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzNetworkSecurityPerimeterProfile -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-DefaultProfile ] [-PassThru] + [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzNetworkSecurityPerimeterProfile -InputObject + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an NSP profile. + +## EXAMPLES + +### Example 1: Deletes a NetworkSecurityPerimeterProfile by Name +```powershell + + Remove-AzNetworkSecurityPerimeterProfile -Name profile6 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + +``` + +Deletes a NetworkSecurityPerimeterProfile by Name + +### Example 2: Deletes a NetworkSecurityPerimeterProfile by identity (using pipe) +```powershell + + $profileObj = Get-AzNetworkSecurityPerimeterProfile -Name profile7 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + Remove-AzNetworkSecurityPerimeterProfile -InputObject $profileObj + +``` + +Deletes a NetworkSecurityPerimeterProfile by identity (using pipe) + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the NSP profile. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: ProfileName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: NetworkSecurityPerimeterName, NSPName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription credentials which uniquely identify the Microsoft Azure subscription. +The subscription ID forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity Parameter + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..2745cb239fec --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,386 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/update-aznetworksecurityperimeteraccessrule +schema: 2.0.0 +--- + +# Update-AzNetworkSecurityPerimeterAccessRule + +## SYNOPSIS +Updates a workspace. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzNetworkSecurityPerimeterAccessRule -Name -ProfileName -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-AddressPrefix ] [-Direction ] + [-FullyQualifiedDomainName ] [-Location ] [-Perimeter ] + [-Subscription ] [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzNetworkSecurityPerimeterAccessRule -InputObject + [-AddressPrefix ] [-Direction ] [-FullyQualifiedDomainName ] + [-Location ] [-Perimeter ] [-Subscription ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates a workspace. + +## EXAMPLES + +### Example 1: Updates a NetworkSecurityPerimeterAccessRule +```powershell + + Update-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 -ProfileName profile1 -AddressPrefix @('10.10.0.0/17') + +``` + +```output + +Location Name +-------- ---- + ar3 + + +``` + +Updates a NetworkSecurityPerimeterAccessRule + +### Example 2: Updates a NetworkSecurityPerimeterAccessRule by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 -ProfileName profile1 + Update-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj -AddressPrefix @('10.0.0.0/16') + +``` + +```output +Location Name +-------- ---- + ar3 + + +``` + +Updates a NetworkSecurityPerimeterAccessRule by identity (using pipe) + +## PARAMETERS + +### -AddressPrefix +Address Prefix + +```yaml +Type: System.Collections.ArrayList +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Direction +Direction + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FullyQualifiedDomainName +Fully qualified domain name + +```yaml +Type: System.Collections.ArrayList +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity parameter. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +Location of the resource + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the access rule. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: AccessRuleName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Perimeter +Inbound rule specified by the perimeter id +To construct, see NOTES section for PERIMETER properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.IPerimeterBasedAccessRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProfileName +The name of the profile + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: NetworkSecurityPerimeterName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Subscription +Subscription ids +To construct, see NOTES section for SUBSCRIPTION properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.ISubscriptionId[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAccessRule + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity parameter. + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +`PERIMETER `: Inbound rule specified by the perimeter id + - `[Id ]`: NSP id in the ARM id format. + +`SUBSCRIPTION `: Subscription ids + - `[Id ]`: Subscription id in the ARM id format. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..5573ca107f5b --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/docs/Update-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,329 @@ +--- +external help file: +Module Name: Az.NetworkSecurityPerimeter +online version: https://docs.microsoft.com/powershell/module/az.networksecurityperimeter/update-aznetworksecurityperimeterassociation +schema: 2.0.0 +--- + +# Update-AzNetworkSecurityPerimeterAssociation + +## SYNOPSIS +Updates an association + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzNetworkSecurityPerimeterAssociation -Name -ResourceGroupName + -SecurityPerimeterName [-SubscriptionId ] [-AccessMode ] [-Location ] + [-PrivateLinkResourceId ] [-ProfileId ] [-Tag ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzNetworkSecurityPerimeterAssociation -InputObject + [-AccessMode ] [-Location ] [-PrivateLinkResourceId ] [-ProfileId ] + [-Tag ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates an association. + +## EXAMPLES + +### Example 1: Updates a NetworkSecurityPerimeterAccessAssociation +```powershell + + Update-AzNetworkSecurityPerimeterAssociation -Name association1 -SecurityPerimeterName nsp3 -ResourceGroupName ResourceGroup-1 -AccessMode Enforced + +``` + +```output +Location Name +-------- ---- + association1 + + +``` + +Updates a NetworkSecurityPerimeterAccessAssociation + +### Example 2: Updates a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name association1 -SecurityPerimeterName nsp3 -ResourceGroupName ResourceGroup-1 + Update-AzNetworkSecurityPerimeterAssociation -InputObject $GETObj -AccessMode Learning + +``` + +```output +Location Name +-------- ---- + association1 + +``` + +Updates a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) + +## PARAMETERS + +### -AccessMode +Access Mode + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity parameter. +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Location +Location of the resource + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the association. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: WorkspaceName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PrivateLinkResourceId +Private link resource id + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProfileId +Network security perimeter profile id + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. +The name is case insensitive. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SecurityPerimeterName +The name of the network security perimeter + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: NetworkSecurityPerimeterName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The ID of the target subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.INetworkSecurityPerimeterIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.NetworkSecurityPerimeter.Models.Api20210201Preview.INspAssociation + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +`INPUTOBJECT `: Identity parameter. + - `[AccessRuleName ]`: The name of the NSP access rule. + - `[AssociationName ]`: The name of the NSP association. + - `[Id ]`: Resource identity path + - `[NetworkSecurityPerimeterName ]`: The name of the network security perimeter. + - `[ProfileName ]`: The name of the NSP profile. + - `[ResourceGroupName ]`: The name of the resource group. + - `[SubscriptionId ]`: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeter.md new file mode 100644 index 000000000000..63e8869fec6a --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeter.md @@ -0,0 +1,59 @@ +### Example 1: List NetworkSecurityPerimeter + +```powershell + + Get-AzNetworkSecurityPerimeter -ResourceGroupName ResourceGroup-1 + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp4 +eastus2euap nsp3 +eastus2euap nsp1 +eastus2euap nsp6 +eastus2euap nsp5 + + +``` +List NetworkSecurityPerimeter + + +### Example 2: Gets a NetworkSecurityPerimeter by Name + +```powershell + + Get-AzNetworkSecurityPerimeter -Name nsp3 -ResourceGroupName ResourceGroup-1 + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp3 + + +``` +Gets a NetworkSecurityPerimeter by Name + + +### Example 3: Gets a NetworkSecurityPerimeter by identity (using pipe) + +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeter -Name nsp3 -ResourceGroupName ResourceGroup-1 + Get-AzNetworkSecurityPerimeter -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp3 + +``` +Gets a NetworkSecurityPerimeter by identity (using pipe) \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..ecf7442db64c --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,52 @@ +### Example 1: List NetworkSecurityPerimeterAccessRule + +```powershell + + Get-AzNetworkSecurityPerimeterAccessRule -ProfileName profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + ar4 + ar3 + + +``` +List NetworkSecurityPerimeterAccessRule + +### Example 2: Gets a NetworkSecurityPerimeterAccessRule by Name +```powershell + + Get-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ProfileName profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + ar3 + + +``` +Gets a NetworkSecurityPerimeterAccessRule by Name + +### Example 3: Gets a NetworkSecurityPerimeterAccessRule by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ProfileName profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + Get-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- + ar3 + +``` +Gets a NetworkSecurityPerimeterAccessRule by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..b2ee63f846e4 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,53 @@ +### Example 1: List NetworkSecurityPerimeterAccessAssociation +```powershell + + Get-AzNetworkSecurityPerimeterAssociation -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + association1 + association3 + + +``` +List NetworkSecurityPerimeterAccessAssociation + +### Example 2: Gets a NetworkSecurityPerimeterAccessAssociation by Name + +```powershell + + Get-AzNetworkSecurityPerimeterAssociation -Name association3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- + association3 + + +``` +Gets a NetworkSecurityPerimeterAccessAssociation by Name + +### Example 3: Gets a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name association3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + Get-AzNetworkSecurityPerimeterAssociation -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- + association3 + + +``` +Gets a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterProfile.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterProfile.md new file mode 100644 index 000000000000..99398aa14094 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Get-AzNetworkSecurityPerimeterProfile.md @@ -0,0 +1,58 @@ +### Example 1: Gets a NetworkSecurityPerimeterProfile by Name + +```powershell + + Get-AzNetworkSecurityPerimeterProfile -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 +eastus2euap profile2 + + +``` +Lists NetworkSecurityPerimeterProfile + + +### Example 2: Gets a NetworkSecurityPerimeterProfile by Name + +```powershell + + Get-AzNetworkSecurityPerimeterProfile -Name profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 + + +``` +Gets a NetworkSecurityPerimeterProfile by Name + + +### Example 3: Gets a NetworkSecurityPerimeterProfile by identity (using pipe) + +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterProfile -Name profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + Get-AzNetworkSecurityPerimeterProfile -InputObject $GETObj + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 + + +``` +Gets a NetworkSecurityPerimeterProfile by identity (using pipe) + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeter.md new file mode 100644 index 000000000000..ef62e337b9b9 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeter.md @@ -0,0 +1,33 @@ +### Example 1: Creates a NetworkSecurityPerimeter +```powershell + + New-AzNetworkSecurityPerimeter -ResourceGroupName ResourceGroup-1 -Name nsp1 -Location eastus2euap + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp1 + + +``` +Creates a NetworkSecurityPerimeter + +### Example 2: Creates a NetworkSecurityPerimeter +```powershell + + New-AzNetworkSecurityPerimeter -ResourceGroupName ResourceGroup-1 -Name nsp2 -Location eastus2euap + +``` + +```output + +Location Name +-------- ---- +eastus2euap nsp2 + + +``` +Creates a NetworkSecurityPerimeter diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..877c44da49c2 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,46 @@ +### Example 1: Creates a NetworkSecurityPerimeterAccessRule +```powershell + + New-AzNetworkSecurityPerimeterAccessRule -Name accessRule1 -ProfileName profile2 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 -AddressPrefix '10.10.0.0/16' -Direction 'Inbound' -Location eastus2euap + +``` + +```output + +Location Name +-------- ---- + accessRule1 + + +``` +Creates a NetworkSecurityPerimeterAccessRule + +### Example 2: Creates a NetworkSecurityPerimeterAccessRule +```powershell + +$perimeter1 = @{ + id='/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.Network/networkSecurityPerimeters/kaushal-nsp1' + perimeterGuid='' + location='eastus2euap' +} + +$perimeter2 = @{ + id='/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.Network/networkSecurityPerimeters/kk-nsp4' + perimeterGuid='bcf8bf02-8b8a-4bcb-933d-2b575d94ec8f' + location='eastus2euap' +} + +$networkSecurityPerimeters = @($perimeter1,$perimeter2) + +New-AzNetworkSecurityPerimeterAccessRule -Name 'perimeter-ar' -SecurityPerimeterName 'testt-nsp1' -ProfileName 't-profile2' -ResourceGroupName 'ResourceGroup-1' -Direction 'Inbound' -Location 'eastus2euap' -NetworkSecurityPerimeters $networkSecurityPerimeters + +``` + +```output + +Location Name +-------- ---- + perimeter_ar + +``` +Creates a NetworkSecurityPerimeterAccessRule \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..952a6fa1436b --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,18 @@ +### Example 1: Creates a NetworkSecurityPerimeterAccessAssociation +```powershell + + $profileId = '/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.Network/networkSecurityPerimeters/nsp3/profiles/profile2' + $privateLinkResourceId = '/subscriptions//resourceGroups/ResourceGroup-1/providers/Microsoft.KeyVault/vaults/rp4' + New-AzNetworkSecurityPerimeterAssociation -Name association1 -SecurityPerimeterName nsp3 -ResourceGroupName ResourceGroup-1 -Location eastus2euap -AccessMode Learning -ProfileId $profileId -PrivateLinkResourceId $privateLinkResourceId + +``` + +```output + +Location Name +-------- ---- + association1 + + +``` +Creates a NetworkSecurityPerimeterAccessAssociation diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterProfile.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterProfile.md new file mode 100644 index 000000000000..753081eefe85 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/New-AzNetworkSecurityPerimeterProfile.md @@ -0,0 +1,33 @@ +### Example 1: Creates a NetworkSecurityPerimeterProfile +```powershell + + New-AzNetworkSecurityPerimeterProfile -Name profile1 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile1 + + +``` +Creates a NetworkSecurityPerimeterProfile + +### Example 2: Creates a NetworkSecurityPerimeterProfile +```powershell + + New-AzNetworkSecurityPerimeterProfile -Name profile2 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 + +``` + +```output + +Location Name +-------- ---- +eastus2euap profile2 + + +``` +Creates a NetworkSecurityPerimeterProfile diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeter.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeter.md new file mode 100644 index 000000000000..cb981bad1c05 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeter.md @@ -0,0 +1,18 @@ +### Example 1: Deletes a NetworkSecurityPerimeter by Name +```powershell + + Remove-AzNetworkSecurityPerimeter -Name nsp5 -ResourceGroupName ResourceGroup-1 + +``` + +Deletes a NetworkSecurityPerimeter by Name + +### Example 2: Deletes a NetworkSecurityPerimeter by identity (using pipe) +```powershell + + $nspObj = Get-AzNetworkSecurityPerimeter -Name nsp6 -ResourceGroupName ResourceGroup-1 + Remove-AzNetworkSecurityPerimeter -InputObject $nspObj + +``` + +Deletes a NetworkSecurityPerimeter by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..41c506e7f028 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,20 @@ +### Example 1: Deletes a NetworkSecurityPerimeterAccessRule by Name + +```powershell + + Remove-AzNetworkSecurityPerimeterAccessRule -Name ar5 -ProfileName profile4 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + +``` + +Deletes a NetworkSecurityPerimeterAccessRule by Name + + +### Example 2: Deletes a NetworkSecurityPerimeterAccessRule by identity (using pipe) +```powershell + + $accessRuleObj = Get-AzNetworkSecurityPerimeterAccessRule -Name ar6 -ProfileName profile4 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + Remove-AzNetworkSecurityPerimeterAccessRule -InputObject $accessRuleObj + +``` + +Deletes a NetworkSecurityPerimeterAccessRule by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..c282a87c24df --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,18 @@ +### Example 1: Deletes a NetworkSecurityPerimeterAccessAssociation by Name +```powershell + + Remove-AzNetworkSecurityPerimeterAssociation -Name association4 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + +``` + +Deletes a NetworkSecurityPerimeterAccessAssociation by Name + +### Example 2: Deletes a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) +```powershell + + $associationObj = Get-AzNetworkSecurityPerimeterAssociation -Name association5 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + Remove-AzNetworkSecurityPerimeterAssociation -InputObject $associationObj + +``` + +Deletes a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterProfile.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterProfile.md new file mode 100644 index 000000000000..0626080638fe --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Remove-AzNetworkSecurityPerimeterProfile.md @@ -0,0 +1,20 @@ +### Example 1: Deletes a NetworkSecurityPerimeterProfile by Name + +```powershell + + Remove-AzNetworkSecurityPerimeterProfile -Name profile6 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + +``` + +Deletes a NetworkSecurityPerimeterProfile by Name + +### Example 2: Deletes a NetworkSecurityPerimeterProfile by identity (using pipe) + +```powershell + + $profileObj = Get-AzNetworkSecurityPerimeterProfile -Name profile7 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp4 + Remove-AzNetworkSecurityPerimeterProfile -InputObject $profileObj + +``` + +Deletes a NetworkSecurityPerimeterProfile by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAccessRule.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAccessRule.md new file mode 100644 index 000000000000..2520b35b1d70 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAccessRule.md @@ -0,0 +1,36 @@ + +### Example 1: Updates a NetworkSecurityPerimeterAccessRule + +```powershell + + Update-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 -ProfileName profile1 -AddressPrefix @('10.10.0.0/17') + +``` + +```output + +Location Name +-------- ---- + ar3 + + +``` +Updates a NetworkSecurityPerimeterAccessRule + +### Example 2: Updates a NetworkSecurityPerimeterAccessRule by identity (using pipe) + +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name ar3 -ResourceGroupName ResourceGroup-1 -SecurityPerimeterName nsp3 -ProfileName profile1 + Update-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj -AddressPrefix @('10.0.0.0/16') + +``` + +```output +Location Name +-------- ---- + ar3 + + +``` +Updates a NetworkSecurityPerimeterAccessRule by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAssociation.md b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAssociation.md new file mode 100644 index 000000000000..4b32a6528c6a --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/examples/Update-AzNetworkSecurityPerimeterAssociation.md @@ -0,0 +1,33 @@ +### Example 1: Updates a NetworkSecurityPerimeterAccessAssociation + +```powershell + + Update-AzNetworkSecurityPerimeterAssociation -Name association1 -SecurityPerimeterName nsp3 -ResourceGroupName ResourceGroup-1 -AccessMode Enforced + +``` + +```output +Location Name +-------- ---- + association1 + + +``` +Updates a NetworkSecurityPerimeterAccessAssociation + +### Example 2: Updates a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) + +```powershell + + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name association1 -SecurityPerimeterName nsp3 -ResourceGroupName ResourceGroup-1 + Update-AzNetworkSecurityPerimeterAssociation -InputObject $GETObj -AccessMode Learning + +``` + +```output +Location Name +-------- ---- + association1 + +``` +Updates a NetworkSecurityPerimeterAccessAssociation by identity (using pipe) diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/how-to.md b/src/Network/NetworkSecurityPerimeter.Autorest/how-to.md new file mode 100644 index 000000000000..e8fd01910730 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.NetworkSecurityPerimeter`. + +## Building `Az.NetworkSecurityPerimeter` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [README.md](exports/README.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [README.md](custom/README.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [README.md](examples/README.md) in the `examples` folder. To read more about documentation, look at the [README.md](docs/README.md) in the `docs` folder. + +## Testing `Az.NetworkSecurityPerimeter` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [README.md](examples/README.md) in the `examples` folder. + +## Packing `Az.NetworkSecurityPerimeter` +To pack `Az.NetworkSecurityPerimeter` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.NetworkSecurityPerimeter`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.NetworkSecurityPerimeter.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.NetworkSecurityPerimeter.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.NetworkSecurityPerimeter`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.NetworkSecurityPerimeter` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/license.txt b/src/Network/NetworkSecurityPerimeter.Autorest/license.txt new file mode 100644 index 000000000000..b9f3180fb9af --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/license.txt @@ -0,0 +1,227 @@ +MICROSOFT SOFTWARE LICENSE TERMS + +MICROSOFT AZURE POWERSHELL + +These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + + +-----------------START OF LICENSE-------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +-------------------END OF LICENSE------------------------------------------ + + +----------------START OF THIRD PARTY NOTICE-------------------------------- + + +The software includes the AutoMapper library ("AutoMapper"). The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Provided for Informational Purposes Only + +AutoMapper + +The MIT License (MIT) +Copyright (c) 2010 Jimmy Bogard + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + +*************** + +The software includes Newtonsoft.Json. The MIT License set out below is provided for informational purposes only. It is not the license that governs any part of the software. + +Newtonsoft.Json + +The MIT License (MIT) +Copyright (c) 2007 James Newton-King +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------END OF THIRD PARTY NOTICE---------------------------------------- + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/resources/README.md b/src/Network/NetworkSecurityPerimeter.Autorest/resources/README.md new file mode 100644 index 000000000000..937f07f8fec2 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/resources/README.md @@ -0,0 +1,11 @@ +# Resources +This directory can contain any additional resources for module that are not required at runtime. This directory **does not** get packaged with the module. If you have assets for custom implementation, place them into the `..\custom` folder. + +## Info +- Modifiable: yes +- Generated: no +- Committed: yes +- Packaged: no + +## Purpose +Use this folder to put anything you want to keep around as part of the repository for the module, but is not something that is required for the module. For example, development files, packaged builds, or additional information. This is only intended to be used in repositories where the module's output directory is cleaned, but tangential resources for the module want to remain intact. \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Recording.json new file mode 100644 index 000000000000..c27d8f39eddb --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Recording.json @@ -0,0 +1,166 @@ +{ + "Get-AzNetworkSecurityPerimeter+[NoContext]+List+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "aed9327d-869c-4592-8e1c-fa9b33ee94df" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeter_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11999" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b895021c-3402-4b9f-8072-ad9cb41fed19" ], + "x-ms-correlation-request-id": [ "b895021c-3402-4b9f-8072-ad9cb41fed19" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134900Z:b895021c-3402-4b9f-8072-ad9cb41fed19" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1573" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nextLink\":\"\",\"value\":[{\"name\":\"tiywst-nspD2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD2\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"29a85eae-ca45-4b04-9454-8b08ca8ec2da\",\"provisioningState\":\"Succeeded\"}},{\"name\":\"tiywst-nspDelB1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"0b5d32d2-945c-4e1b-a012-494fb8922366\",\"provisioningState\":\"Succeeded\"}},{\"name\":\"tiywst-nsp1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"054c68b8-d837-4eaa-ae15-c8498dfe3004\",\"provisioningState\":\"Succeeded\"}},{\"name\":\"tiywst-nspD1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"15014d00-07f3-49dd-b7ef-0ffe2bc74a1e\",\"provisioningState\":\"Succeeded\"}}]}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeter+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "9df63f35-17a4-40b2-9076-05e11fe829b0" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeter_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8ea592eb-1e5b-4f91-9966-fa8c562c5cd0" ], + "x-ms-correlation-request-id": [ "8ea592eb-1e5b-4f91-9966-fa8c562c5cd0" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134901Z:8ea592eb-1e5b-4f91-9966-fa8c562c5cd0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "383" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"tiywst-nsp1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"054c68b8-d837-4eaa-ae15-c8498dfe3004\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeter+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "b521b520-b3cf-49cd-97e1-f503b5209458" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeter_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1c7c8823-8b01-4ec7-95da-217e56d51478" ], + "x-ms-correlation-request-id": [ "1c7c8823-8b01-4ec7-95da-217e56d51478" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134902Z:1c7c8823-8b01-4ec7-95da-217e56d51478" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "383" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"tiywst-nsp1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"054c68b8-d837-4eaa-ae15-c8498dfe3004\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeter+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "eecf9964-f6ad-4f3e-9440-a913689df7c7" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeter_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "71d73bf9-0905-4b3b-ab5a-e559e04b3e1a" ], + "x-ms-correlation-request-id": [ "71d73bf9-0905-4b3b-ab5a-e559e04b3e1a" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134903Z:71d73bf9-0905-4b3b-ab5a-e559e04b3e1a" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "383" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"tiywst-nsp1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"054c68b8-d837-4eaa-ae15-c8498dfe3004\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Tests.ps1 new file mode 100644 index 000000000000..a14a84ccfa5f --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeter.Tests.ps1 @@ -0,0 +1,36 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzNetworkSecurityPerimeter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzNetworkSecurityPerimeter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzNetworkSecurityPerimeter' { + It 'List' { + { Get-AzNetworkSecurityPerimeter -ResourceGroupName $env.rgname } | Should -Not -Throw + } + + It 'Get' { + { Get-AzNetworkSecurityPerimeter -Name $env.tmpNsp1 -ResourceGroupName $env.rgname } | Should -Not -Throw + } + + It 'GetViaIdentity' { + { + + $GETObj = Get-AzNetworkSecurityPerimeter -Name $env.tmpNsp1 -ResourceGroupName $env.rgname + $GETObjViaIdentity = Get-AzNetworkSecurityPerimeter -InputObject $GETObj + + $GETObj.Name | Should -Be $GETObjViaIdentity.Name + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Recording.json new file mode 100644 index 000000000000..69f74f62dbed --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Recording.json @@ -0,0 +1,166 @@ +{ + "Get-AzNetworkSecurityPerimeterAccessRule+[NoContext]+List+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "14747319-0de4-40e1-94b6-48ae0b7e51f3" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ede82940-64e5-41df-8e7e-5abc9563404e" ], + "x-ms-correlation-request-id": [ "ede82940-64e5-41df-8e7e-5abc9563404e" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134904Z:ede82940-64e5-41df-8e7e-5abc9563404e" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "965" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nextLink\":\"\",\"value\":[{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}},{\"name\":\"t-ar2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Outbound\",\"addressPrefixes\":[],\"fullyQualifiedDomainNames\":[\"*\"],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}]}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterAccessRule+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "c7e36ce8-9e51-4980-8369-5a333e3e9ac0" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11994" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "eb024bfa-ba0f-48f7-9d5b-6cbc36969f23" ], + "x-ms-correlation-request-id": [ "eb024bfa-ba0f-48f7-9d5b-6cbc36969f23" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134905Z:eb024bfa-ba0f-48f7-9d5b-6cbc36969f23" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterAccessRule+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "12d57b49-6cb8-484d-aad9-57c9ad4a8d80" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a21c4a48-068e-4d63-90cb-f6826db1c679" ], + "x-ms-correlation-request-id": [ "a21c4a48-068e-4d63-90cb-f6826db1c679" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134905Z:a21c4a48-068e-4d63-90cb-f6826db1c679" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterAccessRule+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "9" ], + "x-ms-client-request-id": [ "78b7f0c1-3ebc-4581-841b-c816852385cd" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "131331f8-8f58-4749-96d0-b7f655185b4f" ], + "x-ms-correlation-request-id": [ "131331f8-8f58-4749-96d0-b7f655185b4f" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134906Z:131331f8-8f58-4749-96d0-b7f655185b4f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:05 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 new file mode 100644 index 000000000000..682d097e6334 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzNetworkSecurityPerimeterAccessRule')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzNetworkSecurityPerimeterAccessRule.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzNetworkSecurityPerimeterAccessRule' { + It 'List' { + { + Get-AzNetworkSecurityPerimeterAccessRule -ProfileName $env.tmpProfile1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + } | Should -Not -Throw + } + + It 'Get' { + { + + Get-AzNetworkSecurityPerimeterAccessRule -Name $env.tmpAccessRule1 -ProfileName $env.tmpProfile1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + + } | Should -Not -Throw + } + + It 'GetViaIdentity' { + { + + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name $env.tmpAccessRule1 -ProfileName $env.tmpProfile1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + $GETObjViaIdentity = Get-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj + + $GETObj.Name | Should -Be $GETObjViaIdentity.Name + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Recording.json new file mode 100644 index 000000000000..d06418f57909 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Recording.json @@ -0,0 +1,166 @@ +{ + "Get-AzNetworkSecurityPerimeterAssociation+[NoContext]+List+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "10" ], + "x-ms-client-request-id": [ "7d3817b5-55ea-4036-942e-7d48e5036dcd" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "054d83d4-4287-47cc-9a5c-22b363bd8a04" ], + "x-ms-correlation-request-id": [ "054d83d4-4287-47cc-9a5c-22b363bd8a04" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134907Z:054d83d4-4287-47cc-9a5c-22b363bd8a04" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "769" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nextLink\":\"\",\"value\":[{\"name\":\"t-asn1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas1Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}]}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterAssociation+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "11" ], + "x-ms-client-request-id": [ "a29f5517-63b4-4063-84ad-bde0c14bec64" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "88846de4-9fc8-4608-9998-4fc05f2f9113" ], + "x-ms-correlation-request-id": [ "88846de4-9fc8-4608-9998-4fc05f2f9113" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134908Z:88846de4-9fc8-4608-9998-4fc05f2f9113" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "743" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-asn1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas1Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterAssociation+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "12" ], + "x-ms-client-request-id": [ "cc8825f7-3e45-48f8-9981-94edbdba4b08" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "55696970-f64e-493e-9c8b-a092ae5a33f3" ], + "x-ms-correlation-request-id": [ "55696970-f64e-493e-9c8b-a092ae5a33f3" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134909Z:55696970-f64e-493e-9c8b-a092ae5a33f3" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "743" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-asn1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas1Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterAssociation+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "13" ], + "x-ms-client-request-id": [ "a4ff9e2f-3305-4842-bb67-fcb81280fb10" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9bbbc0e9-001b-44c2-ae97-70cfc06e63b8" ], + "x-ms-correlation-request-id": [ "9bbbc0e9-001b-44c2-ae97-70cfc06e63b8" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134909Z:9bbbc0e9-001b-44c2-ae97-70cfc06e63b8" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "743" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-asn1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/t-asn1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas1Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Tests.ps1 new file mode 100644 index 000000000000..4f22fb052f8b --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterAssociation.Tests.ps1 @@ -0,0 +1,45 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzNetworkSecurityPerimeterAssociation')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzNetworkSecurityPerimeterAssociation.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzNetworkSecurityPerimeterAssociation' { + It 'List' { + { + + + Get-AzNetworkSecurityPerimeterAssociation -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + + + } | Should -Not -Throw + } + + It 'Get' { + { + + Get-AzNetworkSecurityPerimeterAssociation -Name $env.tmpAssociation1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + + } | Should -Not -Throw + } + + It 'GetViaIdentity' { + { + + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name $env.tmpAssociation1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + $GETObjViaIdentity = Get-AzNetworkSecurityPerimeterAssociation -InputObject $GETObj + $GETObj.Name | Should -Be $GETObjViaIdentity.Name + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Recording.json new file mode 100644 index 000000000000..aa8bfaeed8ee --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Recording.json @@ -0,0 +1,166 @@ +{ + "Get-AzNetworkSecurityPerimeterProfile+[NoContext]+List+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "14" ], + "x-ms-client-request-id": [ "52a48946-6aaa-4e2f-8869-12d65799a6eb" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterProfile_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11987" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b944447a-07bf-4adf-9af3-d85acaf79c19" ], + "x-ms-correlation-request-id": [ "b944447a-07bf-4adf-9af3-d85acaf79c19" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134910Z:b944447a-07bf-4adf-9af3-d85acaf79c19" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1111" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nextLink\":\"\",\"value\":[{\"name\":\"t-profile3\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile3\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"0\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"},{\"name\":\"t-profile1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"2\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"},{\"name\":\"t-profile2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"0\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"}]}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterProfile+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "a47c72d9-8410-45d5-a4bf-2bbbc59eab07" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterProfile_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11986" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0218e43b-c779-403c-b78f-f51e24b8dea7" ], + "x-ms-correlation-request-id": [ "0218e43b-c779-403c-b78f-f51e24b8dea7" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134911Z:0218e43b-c779-403c-b78f-f51e24b8dea7" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "361" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-profile1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"2\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterProfile+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "fc42d588-0f95-4b5a-ae2f-11ba4a86c0d6" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterProfile_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11985" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "2f08ac3b-a354-43eb-9a53-af1ab6b923e0" ], + "x-ms-correlation-request-id": [ "2f08ac3b-a354-43eb-9a53-af1ab6b923e0" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134912Z:2f08ac3b-a354-43eb-9a53-af1ab6b923e0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "361" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-profile1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"2\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"}", + "isContentBase64": false + } + }, + "Get-AzNetworkSecurityPerimeterProfile+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "f2670bf8-6565-4053-b564-2fd2e038f90b" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterProfile_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11984" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8b1a188b-c2ec-47e4-a41b-d667e1b17998" ], + "x-ms-correlation-request-id": [ "8b1a188b-c2ec-47e4-a41b-d667e1b17998" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134913Z:8b1a188b-c2ec-47e4-a41b-d667e1b17998" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "361" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-profile1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"2\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Tests.ps1 new file mode 100644 index 000000000000..51e3c3225a42 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Get-AzNetworkSecurityPerimeterProfile.Tests.ps1 @@ -0,0 +1,43 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzNetworkSecurityPerimeterProfile')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzNetworkSecurityPerimeterProfile.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzNetworkSecurityPerimeterProfile' { + It 'List' { + { + + Get-AzNetworkSecurityPerimeterProfile -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + + } | Should -Not -Throw + } + + It 'Get' { + { + + Get-AzNetworkSecurityPerimeterProfile -Name $env.tmpProfile1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + + } | Should -Not -Throw + } + + It 'GetViaIdentity' { + { + + $GETObj = Get-AzNetworkSecurityPerimeterProfile -Name $env.tmpProfile1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + $GETObjViaIdentity = Get-AzNetworkSecurityPerimeterProfile -InputObject $GETObj + $GETObj.Name | Should -Be $GETObjViaIdentity.Name + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Recording.json new file mode 100644 index 000000000000..fd77c70f8057 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Recording.json @@ -0,0 +1,38 @@ +{ + "New-AzNetworkSecurityPerimeter+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiyws-psnsp1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiyws-psnsp1?api-version=2021-02-01-preview", + "Content": "{\r\n \"location\": \"eastus2euap\"\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "33" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "471a2f69-8fd9-4738-af91-bd5c47cdec37" ], + "x-ms-correlation-request-id": [ "471a2f69-8fd9-4738-af91-bd5c47cdec37" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134923Z:471a2f69-8fd9-4738-af91-bd5c47cdec37" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "385" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"tiyws-psnsp1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiyws-psnsp1\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"7235a33a-9ab3-4e8c-8a4d-3b072b034d40\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Tests.ps1 new file mode 100644 index 000000000000..66984e002940 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeter.Tests.ps1 @@ -0,0 +1,26 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzNetworkSecurityPerimeter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzNetworkSecurityPerimeter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzNetworkSecurityPerimeter' { + It 'CreateExpanded'{ + { + + $nspName = $env.randomStr + '-' + $env.nsp1 + + New-AzNetworkSecurityPerimeter -ResourceGroupName $env.rgname -Name $nspName -Location $env.location + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Recording.json new file mode 100644 index 000000000000..6e82560197aa --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Recording.json @@ -0,0 +1,74 @@ +{ + "New-AzNetworkSecurityPerimeterAccessRule+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2/accessRules/psaccessrule1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2/accessRules/psaccessrule1?api-version=2021-02-01-preview", + "Content": "{\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"direction\": \"Inbound\",\r\n \"addressPrefixes\": [ \"10.10.0.0/16\" ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "130" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d27e975c-2b0f-44d8-b287-579f5b2186b2" ], + "x-ms-correlation-request-id": [ "d27e975c-2b0f-44d8-b287-579f5b2186b2" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134924Z:d27e975c-2b0f-44d8-b287-579f5b2186b2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "490" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psaccessrule1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2/accessRules/psaccessrule1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "New-AzNetworkSecurityPerimeterAccessRule+[NoContext]+CreateExpandedWithSubscriptions+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2/accessRules/psaccessrule1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2/accessRules/psaccessrule1?api-version=2021-02-01-preview", + "Content": "{\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"direction\": \"Inbound\",\r\n \"subscriptions\": [\r\n {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9\"\r\n }\r\n ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "205" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a1c4c83a-0f6c-484c-91bf-c29e8218dbf5" ], + "x-ms-correlation-request-id": [ "a1c4c83a-0f6c-484c-91bf-c29e8218dbf5" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134925Z:a1c4c83a-0f6c-484c-91bf-c29e8218dbf5" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "536" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psaccessrule1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2/accessRules/psaccessrule1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9\"}],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 new file mode 100644 index 000000000000..af4d26a23d4f --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 @@ -0,0 +1,36 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzNetworkSecurityPerimeterAccessRule')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzNetworkSecurityPerimeterAccessRule.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzNetworkSecurityPerimeterAccessRule' { + It 'CreateExpanded' { + { + + New-AzNetworkSecurityPerimeterAccessRule -Name $env.accessRule1 -ProfileName $env.tmpProfile2 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 -AddressPrefix '10.10.0.0/16' -Direction 'Inbound' -Location $env.location + + } | Should -Not -Throw + } + + It 'CreateExpandedWithSubscriptions' { + { + $sub1 = @{ + id= '/subscriptions/' + $env.SubscriptionId + } + + New-AzNetworkSecurityPerimeterAccessRule -Name $env.accessRule1 -ProfileName $env.tmpProfile2 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 -Subscription @($sub1) -Direction 'Inbound' -Location $env.location + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Recording.json new file mode 100644 index 000000000000..bad4e560e0dc --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Recording.json @@ -0,0 +1,38 @@ +{ + "New-AzNetworkSecurityPerimeterAssociation+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": "{\r\n \"location\": \"eastus2euap\",\r\n \"properties\": {\r\n \"privateLinkResource\": {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"\r\n },\r\n \"profile\": {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"\r\n },\r\n \"accessMode\": \"Learning\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "495" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7a628b8d-80bf-47e8-839f-daf6040a34e7" ], + "x-ms-correlation-request-id": [ "7a628b8d-80bf-47e8-839f-daf6040a34e7" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134927Z:7a628b8d-80bf-47e8-839f-daf6040a34e7" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "758" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Learning\",\"provisioningState\":\"Accepted\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Tests.ps1 new file mode 100644 index 000000000000..921e55fb401f --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterAssociation.Tests.ps1 @@ -0,0 +1,28 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzNetworkSecurityPerimeterAssociation')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzNetworkSecurityPerimeterAssociation.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzNetworkSecurityPerimeterAssociation' { + It 'CreateExpanded' { + { + + $profileId = '/subscriptions/' + $env.SubscriptionId + '/resourceGroups/' + $env.rgname + '/providers/Microsoft.Network/networkSecurityPerimeters/' + $env.tmpNsp1 + '/profiles/' + $env.tmpProfile2 + $privateLinkResourceId = '/subscriptions/' + $env.SubscriptionId + '/resourceGroups/' + $env.rgname + '/providers/Microsoft.KeyVault/vaults/' + $env.tmpPaas4Rp + + New-AzNetworkSecurityPerimeterAssociation -Name $env.association1 -SecurityPerimeterName $env.tmpNsp1 -ResourceGroupName $env.rgname -Location $env.location -AccessMode $env.accessMode1 -ProfileId $profileId -PrivateLinkResourceId $privateLinkResourceId + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Recording.json new file mode 100644 index 000000000000..86b41f247cef --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Recording.json @@ -0,0 +1,38 @@ +{ + "New-AzNetworkSecurityPerimeterProfile+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/psprofile1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/psprofile1?api-version=2021-02-01-preview", + "Content": "{\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "4" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "855aa8c8-1502-4e49-a847-e8735c010a7e" ], + "x-ms-correlation-request-id": [ "855aa8c8-1502-4e49-a847-e8735c010a7e" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134928Z:855aa8c8-1502-4e49-a847-e8735c010a7e" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "361" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psprofile1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/psprofile1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"0\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Tests.ps1 new file mode 100644 index 000000000000..231259bdeb6e --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/New-AzNetworkSecurityPerimeterProfile.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzNetworkSecurityPerimeterProfile')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzNetworkSecurityPerimeterProfile.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzNetworkSecurityPerimeterProfile' { + It 'CreateExpanded' { + { + + New-AzNetworkSecurityPerimeterProfile -Name $env.profile1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/NspTemplate.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/NspTemplate.json new file mode 100644 index 000000000000..3eaaa6a57b89 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/NspTemplate.json @@ -0,0 +1,902 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "defaultValue": "eastus2euap" + }, + "nsp1Name": { + "type": "string", + "defaultValue": "t-nsp1", + "metadata": { + "description": "Name of the NSP resource." + } + }, + "nspDelBase1Name": { + "type": "string", + "defaultValue": "t-nspDelBase1", + "metadata": { + "description": "Name of the NSP resource." + } + }, + "nspDelete1Name": { + "type": "string", + "defaultValue": "t-nspDel1", + "metadata": { + "description": "Name of the NSP resource." + } + }, + "nspDelete2Name": { + "type": "string", + "defaultValue": "t-nspDel2", + "metadata": { + "description": "Name of the NSP resource." + } + }, + "profile1Name": { + "type": "string", + "defaultValue": "t-profile1", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "profile2Name": { + "type": "string", + "defaultValue": "t-profile2", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "profile3Name": { + "type": "string", + "defaultValue": "t-profile3", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "profileDelBase1Name": { + "type": "string", + "defaultValue": "t-prDelB1", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "profileDelBase2Name": { + "type": "string", + "defaultValue": "t-prDelB2", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "profileDelete1Name": { + "type": "string", + "defaultValue": "t-profileDel1", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "profileDelete2Name": { + "type": "string", + "defaultValue": "t-profileDel2", + "metadata": { + "description": "Name of the NSP profile." + } + }, + "accessRule1Name": { + "type": "string", + "defaultValue": "t-accessRule1", + "metadata": { + "description": "Name of the NSP access rule." + } + }, + "accessRule2Name": { + "type": "string", + "defaultValue": "t-accessRule2", + "metadata": { + "description": "Name of the NSP access rule." + } + }, + "accessRuleDelete1Name": { + "type": "string", + "defaultValue": "t-arDel1", + "metadata": { + "description": "Name of the NSP access rule." + } + }, + "accessRuleDelete2Name": { + "type": "string", + "defaultValue": "t-arDel2", + "metadata": { + "description": "Name of the NSP access rule." + } + }, + "paas1Name": { + "defaultValue": "t-passrp1", + "type": "String", + "metadata": { + "description": "Name of the PAAS resource." + } + }, + "paas2Name": { + "defaultValue": "t-passrp2", + "type": "String", + "metadata": { + "description": "Name of the PAAS resource." + } + }, + "paas3Name": { + "defaultValue": "t-passrp3", + "type": "String", + "metadata": { + "description": "Name of the PAAS resource." + } + }, + "paas4Name": { + "defaultValue": "t-passrp4", + "type": "String", + "metadata": { + "description": "Name of the PAAS resource." + } + }, + "tenantName": { + "defaultValue": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "type": "string" + }, + "association1Name": { + "type": "string", + "defaultValue": "t-asn1" + }, + "associationDelete1Name": { + "type": "string", + "defaultValue": "t-asnD1" + }, + "associationDelete2Name": { + "type": "string", + "defaultValue": "t-asnD2" + } + }, + "variables": { + "nsp1ResourceName": "[parameters('nsp1Name')]", + "nspDelBase1ResourceName": "[parameters('nspDelBase1Name')]", + "nspDelete1ResourceName": "[parameters('nspDelete1Name')]", + "nspDelete2ResourceName": "[parameters('nspDelete2Name')]", + "profile1ResourceName": "[concat(variables('nsp1ResourceName'), '/', parameters('profile1Name'))]", + "profile2ResourceName": "[concat(variables('nsp1ResourceName'), '/', parameters('profile2Name'))]", + "profile3ResourceName": "[concat(variables('nsp1ResourceName'), '/', parameters('profile3Name'))]", + "profileDelBase1ResourceName": "[concat(variables('nspDelBase1ResourceName'), '/', parameters('profileDelBase1Name'))]", + "profileDelBase2ResourceName": "[concat(variables('nspDelBase1ResourceName'), '/', parameters('profileDelBase2Name'))]", + "profileDelete1ResourceName": "[concat(variables('nspDelBase1ResourceName'), '/', parameters('profileDelete1Name'))]", + "profileDelete2ResourceName": "[concat(variables('nspDelBase1ResourceName'), '/', parameters('profileDelete2Name'))]", + "accessRule1ResourceName": "[concat(variables('profile1ResourceName'), '/', parameters('accessRule1Name'))]", + "accessRule2ResourceName": "[concat(variables('profile1ResourceName'), '/', parameters('accessRule2Name'))]", + "accessRuleDelete1ResourceName": "[concat(variables('profileDelBase1ResourceName'), '/', parameters('accessRuleDelete1Name'))]", + "accessRuleDelete2ResourceName": "[concat(variables('profileDelBase1ResourceName'), '/', parameters('accessRuleDelete2Name'))]", + "paas1ResourceName": "[parameters('paas1Name')]", + "paas2ResourceName": "[parameters('paas2Name')]", + "paas3ResourceName": "[parameters('paas3Name')]", + "paas4ResourceName": "[parameters('paas4Name')]", + "association1ResourceName": "[concat(variables('nsp1ResourceName'), '/', parameters('association1Name'))]", + "associationDelete1ResourceName": "[concat(variables('nspDelBase1ResourceName'), '/', parameters('associationDelete1Name'))]", + "associationDelete2ResourceName": "[concat(variables('nspDelBase1ResourceName'), '/', parameters('associationDelete2Name'))]" + }, + "resources": [ + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters", + "name": "[variables('nsp1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [], + "properties": { + "displayName": "NetworkSecurityPerimeter 3", + "description": "The third network security perimeter." + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters", + "name": "[variables('nspDelBase1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [], + "properties": { + "displayName": "NetworkSecurityPerimeter 3", + "description": "The third network security perimeter." + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters", + "name": "[variables('nspDelete1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [], + "properties": { + "displayName": "NetworkSecurityPerimeter 3", + "description": "The third network security perimeter." + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters", + "name": "[variables('nspDelete2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [], + "properties": { + "displayName": "NetworkSecurityPerimeter 3", + "description": "The third network security perimeter." + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profile1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nsp1ResourceName'))]" + ], + "properties": { + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profile2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nsp1ResourceName'))]" + ], + "properties": { + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profile3ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nsp1ResourceName'))]" + ], + "properties": { + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profileDelBase2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelBase1ResourceName'))]" + ], + "properties": { + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profileDelete1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelBase1ResourceName'))]" + ], + "properties": { + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profileDelBase1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelBase1ResourceName'))]" + ], + "properties": { + } + }, + + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles", + "name": "[variables('profileDelete2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelBase1ResourceName'))]" + ], + "properties": { + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules", + "name": "[variables('accessRule1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile1Name'))]" + ], + "properties": { + "displayName": "NSP Access Rule - 1", + "description": "NSP Access Rule - 1", + "direction": "Inbound", + "addressPrefixes": [ + "10.10.0.0/16" + ] + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules", + "name": "[variables('accessRule2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile1Name'))]" + ], + "properties": { + "displayName": "NSP Access Rule - 1", + "description": "NSP Access Rule - 1", + "direction": "Outbound", + "fullyQualifiedDomainNames": [ + "*" + ] + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules", + "name": "[variables('accessRuleDelete1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'))]" + ], + "properties": { + "displayName": "NSP Access Rule - 1", + "description": "NSP Access Rule - 1", + "direction": "Inbound", + "addressPrefixes": [ + "10.10.0.0/16" + ] + } + }, + { + "apiVersion": "2021-02-01-preview", + "type": "Microsoft.Network/networkSecurityPerimeters/profiles/accessRules", + "name": "[variables('accessRuleDelete2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'))]" + ], + "properties": { + "displayName": "NSP Access Rule - 1", + "description": "NSP Access Rule - 1", + "direction": "Inbound", + "addressPrefixes": [ + "10.10.0.0/16" + ] + } + }, + { + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2021-11-01-preview", + "name": "[variables('paas1ResourceName')]", + "location": "[parameters('location')]", + "properties": { + "sku": { + "family": "A", + "name": "Standard" + }, + "tenantId": "[parameters('tenantName')]", + "accessPolicies": [ + { + "tenantId": "[parameters('tenantName')]", + "objectId": "57bfe214-9fdd-4732-bc3d-410323de367f", + "permissions": { + "keys": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "GetRotationPolicy", + "SetRotationPolicy", + "Rotate" + ], + "secrets": [ + "Get", + "List", + "Set", + "Delete", + "Recover", + "Backup", + "Restore" + ], + "certificates": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "ManageContacts", + "ManageIssuers", + "GetIssuers", + "ListIssuers", + "SetIssuers", + "DeleteIssuers" + ] + } + } + ], + "enabledForDeployment": false, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": false, + "enableSoftDelete": true, + "softDeleteRetentionInDays": 90, + "enableRbacAuthorization": false, + "vaultUri": "[concat('https://', variables('paas1ResourceName'), '.vault.azure.net/')]", + "provisioningState": "Succeeded", + "publicNetworkAccess": "Enabled" + } + }, + { + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2021-11-01-preview", + "name": "[variables('paas2ResourceName')]", + "location": "[parameters('location')]", + "properties": { + "sku": { + "family": "A", + "name": "Standard" + }, + "tenantId": "[parameters('tenantName')]", + "accessPolicies": [ + { + "tenantId": "[parameters('tenantName')]", + "objectId": "57bfe214-9fdd-4732-bc3d-410323de367f", + "permissions": { + "keys": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "GetRotationPolicy", + "SetRotationPolicy", + "Rotate" + ], + "secrets": [ + "Get", + "List", + "Set", + "Delete", + "Recover", + "Backup", + "Restore" + ], + "certificates": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "ManageContacts", + "ManageIssuers", + "GetIssuers", + "ListIssuers", + "SetIssuers", + "DeleteIssuers" + ] + } + } + ], + "enabledForDeployment": false, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": false, + "enableSoftDelete": true, + "softDeleteRetentionInDays": 90, + "enableRbacAuthorization": false, + "vaultUri": "[concat('https://', variables('paas2ResourceName'), '.vault.azure.net/')]", + "provisioningState": "Succeeded", + "publicNetworkAccess": "Enabled" + } + }, + { + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2021-11-01-preview", + "name": "[variables('paas3ResourceName')]", + "location": "[parameters('location')]", + "properties": { + "sku": { + "family": "A", + "name": "Standard" + }, + "tenantId": "[parameters('tenantName')]", + "accessPolicies": [ + { + "tenantId": "[parameters('tenantName')]", + "objectId": "57bfe214-9fdd-4732-bc3d-410323de367f", + "permissions": { + "keys": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "GetRotationPolicy", + "SetRotationPolicy", + "Rotate" + ], + "secrets": [ + "Get", + "List", + "Set", + "Delete", + "Recover", + "Backup", + "Restore" + ], + "certificates": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "ManageContacts", + "ManageIssuers", + "GetIssuers", + "ListIssuers", + "SetIssuers", + "DeleteIssuers" + ] + } + } + ], + "enabledForDeployment": false, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": false, + "enableSoftDelete": true, + "softDeleteRetentionInDays": 90, + "enableRbacAuthorization": false, + "vaultUri": "[concat('https://', variables('paas3ResourceName'), '.vault.azure.net/')]", + "provisioningState": "Succeeded", + "publicNetworkAccess": "Enabled" + } + }, + { + "type": "Microsoft.KeyVault/vaults", + "apiVersion": "2021-11-01-preview", + "name": "[variables('paas4ResourceName')]", + "location": "[parameters('location')]", + "properties": { + "sku": { + "family": "A", + "name": "Standard" + }, + "tenantId": "[parameters('tenantName')]", + "accessPolicies": [ + { + "tenantId": "[parameters('tenantName')]", + "objectId": "57bfe214-9fdd-4732-bc3d-410323de367f", + "permissions": { + "keys": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "GetRotationPolicy", + "SetRotationPolicy", + "Rotate" + ], + "secrets": [ + "Get", + "List", + "Set", + "Delete", + "Recover", + "Backup", + "Restore" + ], + "certificates": [ + "Get", + "List", + "Update", + "Create", + "Import", + "Delete", + "Recover", + "Backup", + "Restore", + "ManageContacts", + "ManageIssuers", + "GetIssuers", + "ListIssuers", + "SetIssuers", + "DeleteIssuers" + ] + } + } + ], + "enabledForDeployment": false, + "enabledForDiskEncryption": false, + "enabledForTemplateDeployment": false, + "enableSoftDelete": true, + "softDeleteRetentionInDays": 90, + "enableRbacAuthorization": false, + "vaultUri": "[concat('https://', variables('paas4ResourceName'), '.vault.azure.net/')]", + "provisioningState": "Succeeded", + "publicNetworkAccess": "Enabled" + } + }, + { + "type": "Microsoft.Network/networkSecurityPerimeters/resourceAssociations", + "apiVersion": "2021-02-01-preview", + "name": "[variables('association1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile1Name'))]", + "[resourceId('Microsoft.KeyVault/vaults', variables('paas1ResourceName'))]" + ], + "properties": { + "privateLinkResource": { + "id": "[resourceId('Microsoft.KeyVault/vaults', variables('paas1ResourceName'))]" + }, + "profile": { + "id": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile1Name'))]" + }, + "accessMode": "Enforced" + } + }, + { + "type": "Microsoft.Network/networkSecurityPerimeters/resourceAssociations", + "apiVersion": "2021-02-01-preview", + "name": "[variables('associationDelete1ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'))]", + "[resourceId('Microsoft.KeyVault/vaults', variables('paas2ResourceName'))]" + ], + "properties": { + "privateLinkResource": { + "id": "[resourceId('Microsoft.KeyVault/vaults', variables('paas2ResourceName'))]" + }, + "profile": { + "id": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'))]" + }, + "accessMode": "Enforced" + } + }, + { + "type": "Microsoft.Network/networkSecurityPerimeters/resourceAssociations", + "apiVersion": "2021-02-01-preview", + "name": "[variables('associationDelete2ResourceName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase2Name'))]", + "[resourceId('Microsoft.KeyVault/vaults', variables('paas3ResourceName'))]" + ], + "properties": { + "privateLinkResource": { + "id": "[resourceId('Microsoft.KeyVault/vaults', variables('paas3ResourceName'))]" + }, + "profile": { + "id": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase2Name'))]" + }, + "accessMode": "Enforced" + } + } + ], + "outputs": { + "accessRule1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles/accessRules', variables('nsp1ResourceName'), parameters('profile1Name'), parameters('accessRule1Name'))]" + }, + "accessRule2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles/accessRules', variables('nsp1ResourceName'), parameters('profile1Name'), parameters('accessRule2Name'))]" + }, + "accessRuleDelete1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles/accessRules', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'), parameters('accessRuleDelete1Name'))]" + }, + "accessRuleDelete1Name": { + "type": "string", + "value": "[parameters('accessRuleDelete1Name')]" + }, + "accessRuleDelete2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles/accessRules', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'), parameters('accessRuleDelete2Name'))]" + }, + "accessRuleDelete2Name": { + "type": "string", + "value": "[parameters('accessRuleDelete2Name')]" + }, + "association1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/resourceAssociations', variables('nsp1ResourceName'), parameters('association1Name'))]" + }, + "association1Name": { + "type": "string", + "value": "[parameters('association1Name')]" + }, + "associationDelete1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/resourceAssociations', variables('nspDelBase1ResourceName'), parameters('associationDelete1Name'))]" + }, + "associationDelete1Name": { + "type": "string", + "value": "[parameters('associationDelete1Name')]" + }, + "associationDelete2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/resourceAssociations', variables('nspDelBase1ResourceName'), parameters('associationDelete2Name'))]" + }, + "associationDelete2Name": { + "type": "string", + "value": "[parameters('associationDelete2Name')]" + }, + "nsp1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nsp1ResourceName'))]" + }, + "nsp1Name": { + "type": "string", + "value": "[variables('nsp1ResourceName')]" + }, + "nspDelBase1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelBase1ResourceName'))]" + }, + "nspDelBase1Name": { + "type": "string", + "value": "[variables('nspDelBase1ResourceName')]" + }, + "nspDelete1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelete1ResourceName'))]" + }, + "nspDelete1Name": { + "type": "string", + "value": "[variables('nspDelete1ResourceName')]" + }, + "nspDelete2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters', variables('nspDelete2ResourceName'))]" + }, + "nspDelete2Name": { + "type": "string", + "value": "[variables('nspDelete2ResourceName')]" + }, + "paas1ResourceId": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas1ResourceName'))]" + }, + "paas1ResourceName": { + "type": "string", + "value": "[variables('paas1ResourceName')]" + }, + "paas2ResourceId": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas2ResourceName'))]" + }, + "paas2ResourceName": { + "type": "string", + "value": "[variables('paas2ResourceName')]" + }, + "paas3ResourceId": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas3ResourceName'))]" + }, + "paas3ResourceName": { + "type": "string", + "value": "[variables('paas3ResourceName')]" + }, + "paas4ResourceId": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas4ResourceName'))]" + }, + "paas4ResourceName": { + "type": "string", + "value": "[variables('paas4ResourceName')]" + }, + "privateLinkResourceId1": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas1ResourceName'))]" + }, + "privateLinkResourceId2": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas2ResourceName'))]" + }, + "privateLinkResourceId3": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas3ResourceName'))]" + }, + "privateLinkResourceId4": { + "type": "string", + "value": "[resourceId('Microsoft.KeyVault/vaults', variables('paas4ResourceName'))]" + }, + "profile1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile1Name'))]" + }, + "profile1Name": { + "type": "string", + "value": "[parameters('profile1Name')]" + }, + "profile2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile2Name'))]" + }, + "profile2Name": { + "type": "string", + "value": "[parameters('profile2Name')]" + }, + "profile3ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nsp1ResourceName'), parameters('profile3Name'))]" + }, + "profile3Name": { + "type": "string", + "value": "[parameters('profile3Name')]" + }, + "profileDelBase1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase1Name'))]" + }, + "profileDelBase1Name": { + "type": "string", + "value": "[parameters('profileDelBase1Name')]" + }, + "profileDelBase2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelBase2Name'))]" + }, + "profileDelBase2Name": { + "type": "string", + "value": "[parameters('profileDelBase2Name')]" + }, + "profileDelete1ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelete1Name'))]" + }, + "profileDelete1Name": { + "type": "string", + "value": "[parameters('profileDelete1Name')]" + }, + "profileDelete2ArmId": { + "type": "string", + "value": "[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', variables('nspDelBase1ResourceName'), parameters('profileDelete2Name'))]" + }, + "profileDelete2Name": { + "type": "string", + "value": "[parameters('profileDelete2Name')]" + }, + "resourceGroupId": { + "type": "string", + "value": "[resourceGroup().id]" + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/README.md b/src/Network/NetworkSecurityPerimeter.Autorest/test/README.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/README.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Recording.json new file mode 100644 index 000000000000..635cbd0ecd89 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Recording.json @@ -0,0 +1,123 @@ +{ + "Remove-AzNetworkSecurityPerimeter+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "23" ], + "x-ms-client-request-id": [ "cc8d5016-af13-4723-9630-f67530b33032" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeter_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-request-id": [ "7312199c-860b-45aa-ab48-c51596700695" ], + "x-ms-correlation-request-id": [ "7312199c-860b-45aa-ab48-c51596700695" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134931Z:7312199c-860b-45aa-ab48-c51596700695" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:31 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeter+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD2?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "24" ], + "x-ms-client-request-id": [ "16f820c0-ce4d-4920-b368-32b0d5e1a7d4" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeter_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11983" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a119234d-e9b7-45e7-b967-919514d52547" ], + "x-ms-correlation-request-id": [ "a119234d-e9b7-45e7-b967-919514d52547" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134932Z:a119234d-e9b7-45e7-b967-919514d52547" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "385" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"tiywst-nspD2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD2\",\"location\":\"eastus2euap\",\"type\":\"Microsoft.Network/networkSecurityPerimeters\",\"tags\":{},\"etag\":\"\",\"properties\":{\"perimeterGuid\":\"29a85eae-ca45-4b04-9454-8b08ca8ec2da\",\"provisioningState\":\"Succeeded\"}}", + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeter+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD2?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "25" ], + "x-ms-client-request-id": [ "da113a34-2f88-40a4-baa1-910da1e445ab" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeter" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeter_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "x-ms-request-id": [ "5aedc244-eed3-4a1f-b420-c8e5def60190" ], + "x-ms-correlation-request-id": [ "5aedc244-eed3-4a1f-b420-c8e5def60190" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134934Z:5aedc244-eed3-4a1f-b420-c8e5def60190" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:34 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Tests.ps1 new file mode 100644 index 000000000000..f98cbe86100d --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeter.Tests.ps1 @@ -0,0 +1,34 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzNetworkSecurityPerimeter')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzNetworkSecurityPerimeter.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzNetworkSecurityPerimeter' { + It 'Delete' { + { + + Remove-AzNetworkSecurityPerimeter -Name $env.tmpNspDelete1 -ResourceGroupName $env.rgname + + } | Should -Not -Throw + } + + It 'DeleteViaIdentity' { + { + + $nspObj = Get-AzNetworkSecurityPerimeter -Name $env.tmpNspDelete2 -ResourceGroupName $env.rgname + Remove-AzNetworkSecurityPerimeter -InputObject $nspObj + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Recording.json new file mode 100644 index 000000000000..50b7bf93c42f --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Recording.json @@ -0,0 +1,122 @@ +{ + "Remove-AzNetworkSecurityPerimeterAccessRule+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/tmpAccessRuleDelete1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/tmpAccessRuleDelete1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "26" ], + "x-ms-client-request-id": [ "5daa678b-2628-43ad-a093-f51f8f828643" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeterAccessRule_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14997" ], + "x-ms-request-id": [ "50acc150-3f37-4a6d-a5cd-db2202f42b92" ], + "x-ms-correlation-request-id": [ "50acc150-3f37-4a6d-a5cd-db2202f42b92" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134935Z:50acc150-3f37-4a6d-a5cd-db2202f42b92" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:35 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeterAccessRule+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/t-arD2?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/t-arD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "3f65a7db-5b79-4b99-bed6-bf2611ab3e47" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11982" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6feb7aba-8d38-4d97-b198-64d87c4caa65" ], + "x-ms-correlation-request-id": [ "6feb7aba-8d38-4d97-b198-64d87c4caa65" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134936Z:6feb7aba-8d38-4d97-b198-64d87c4caa65" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "479" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-arD2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/t-arD2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeterAccessRule+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/t-arD2?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB1/accessRules/t-arD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "5d3eaaa7-2f52-433a-8146-5cd9590d3de2" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeterAccessRule_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14996" ], + "x-ms-request-id": [ "351776d5-0b36-4482-9161-83b796d7d943" ], + "x-ms-correlation-request-id": [ "351776d5-0b36-4482-9161-83b796d7d943" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134937Z:351776d5-0b36-4482-9161-83b796d7d943" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:37 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 new file mode 100644 index 000000000000..c339731fbf51 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 @@ -0,0 +1,36 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzNetworkSecurityPerimeterAccessRule')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzNetworkSecurityPerimeterAccessRule.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzNetworkSecurityPerimeterAccessRule' { + It 'Delete' { + { + + Remove-AzNetworkSecurityPerimeterAccessRule -Name tmpAccessRuleDelete1 -ProfileName $env.tmpProfileDelBase1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNspDelBase1 + + } | Should -Not -Throw + } + + It 'DeleteViaIdentity' { + { + + + $accessRuleObj = Get-AzNetworkSecurityPerimeterAccessRule -Name $env.tmpAccessRuleDelete2 -ProfileName $env.tmpProfileDelBase1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNspDelBase1 + + Remove-AzNetworkSecurityPerimeterAccessRule -InputObject $accessRuleObj + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Recording.json new file mode 100644 index 000000000000..ef9c2f6df397 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Recording.json @@ -0,0 +1,121 @@ +{ + "Remove-AzNetworkSecurityPerimeterAssociation+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "b2136b10-abea-4b5e-80ce-bdd3b22c9f3e" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeterAssociation_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14995" ], + "x-ms-request-id": [ "96c32eb5-4ce0-4948-b15e-0d62faff75e3" ], + "x-ms-correlation-request-id": [ "96c32eb5-4ce0-4948-b15e-0d62faff75e3" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134939Z:96c32eb5-4ce0-4948-b15e-0d62faff75e3" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:38 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeterAssociation+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD2?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "449b9ff2-c779-49ad-8f70-7d016e962b4a" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11981" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "372fb2cf-f6fa-4993-8b58-64e630a74c02" ], + "x-ms-correlation-request-id": [ "372fb2cf-f6fa-4993-8b58-64e630a74c02" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134939Z:372fb2cf-f6fa-4993-8b58-64e630a74c02" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "752" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-asnD2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas3Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-prDelB2\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeterAssociation+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD2?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/resourceAssociations/t-asnD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "31" ], + "x-ms-client-request-id": [ "e7fe9acb-be9a-416b-87be-34beb974e641" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeterAssociation_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14994" ], + "x-ms-request-id": [ "08b7b75e-a5d4-41d8-99fc-8041151e9720" ], + "x-ms-correlation-request-id": [ "08b7b75e-a5d4-41d8-99fc-8041151e9720" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134940Z:08b7b75e-a5d4-41d8-99fc-8041151e9720" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:40 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Tests.ps1 new file mode 100644 index 000000000000..7caa368b87b6 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterAssociation.Tests.ps1 @@ -0,0 +1,35 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzNetworkSecurityPerimeterAssociation')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzNetworkSecurityPerimeterAssociation.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzNetworkSecurityPerimeterAssociation' { + It 'Delete' { + { + + Remove-AzNetworkSecurityPerimeterAssociation -Name $env.tmpAssociationDelete1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNspDelBase1 + + } | Should -Not -Throw + } + + It 'DeleteViaIdentity' { + { + + $associationObj = Get-AzNetworkSecurityPerimeterAssociation -Name $env.tmpAssociationDelete2 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNspDelBase1 + + Remove-AzNetworkSecurityPerimeterAssociation -InputObject $associationObj + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Recording.json new file mode 100644 index 000000000000..c3e030a2ed32 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Recording.json @@ -0,0 +1,123 @@ +{ + "Remove-AzNetworkSecurityPerimeterProfile+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "32" ], + "x-ms-client-request-id": [ "737d7fd8-5fa4-43f8-a62d-8fc43db871a9" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeterProfile_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14993" ], + "x-ms-request-id": [ "81b88bfe-3614-4f9f-b798-586d7d54fa89" ], + "x-ms-correlation-request-id": [ "81b88bfe-3614-4f9f-b798-586d7d54fa89" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134941Z:81b88bfe-3614-4f9f-b798-586d7d54fa89" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:41 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeterProfile+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD2?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "33" ], + "x-ms-client-request-id": [ "7f0e6809-37b6-4757-b9ea-4501b4fd514d" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterProfile_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11980" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7567ff32-daa5-4526-95f0-a4f27ba4766f" ], + "x-ms-correlation-request-id": [ "7567ff32-daa5-4526-95f0-a4f27ba4766f" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134942Z:7567ff32-daa5-4526-95f0-a4f27ba4766f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "367" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-profileD2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles\",\"properties\":{\"accessRulesVersion\":\"0\",\"diagnosticSettingsVersion\":\"0\"},\"location\":\"eastus2euap\"}", + "isContentBase64": false + } + }, + "Remove-AzNetworkSecurityPerimeterProfile+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD2?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nspDelB1/profiles/t-profileD2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "34" ], + "x-ms-client-request-id": [ "b7a6fa9e-9bb3-4864-86c0-b07f65db0a1f" ], + "CommandName": [ "Remove-AzNetworkSecurityPerimeterProfile" ], + "FullCommandName": [ "Remove-AzNetworkSecurityPerimeterProfile_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14992" ], + "x-ms-request-id": [ "aa2404b2-3fe3-4d3b-a7c3-e4dd414db8ba" ], + "x-ms-correlation-request-id": [ "aa2404b2-3fe3-4d3b-a7c3-e4dd414db8ba" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134943Z:aa2404b2-3fe3-4d3b-a7c3-e4dd414db8ba" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:42 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null, + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Tests.ps1 new file mode 100644 index 000000000000..4cec4c7b9a75 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Remove-AzNetworkSecurityPerimeterProfile.Tests.ps1 @@ -0,0 +1,36 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzNetworkSecurityPerimeterProfile')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzNetworkSecurityPerimeterProfile.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzNetworkSecurityPerimeterProfile' { + It 'Delete' { + { + + Remove-AzNetworkSecurityPerimeterProfile -Name $env.tmpProfileDelete1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNspDelBase1 + + } | Should -Not -Throw + } + + It 'DeleteViaIdentity' { + { + + $profileObj = Get-AzNetworkSecurityPerimeterProfile -Name $env.tmpProfileDelete2 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNspDelBase1 + + Remove-AzNetworkSecurityPerimeterProfile -InputObject $profileObj + + } | Should -Not -Throw + } +} + \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Recording.json new file mode 100644 index 000000000000..4f1b169ca7f9 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Recording.json @@ -0,0 +1,315 @@ +{ + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "1a43f879-b55e-4f68-b12c-d1a7aed3c289" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11979" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a2e99c74-72f3-43e2-86da-d153fcc3683e" ], + "x-ms-correlation-request-id": [ "a2e99c74-72f3-43e2-86da-d153fcc3683e" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134944Z:a2e99c74-72f3-43e2-86da-d153fcc3683e" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": "{\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\r\n \"properties\": {\r\n \"direction\": \"Inbound\",\r\n \"addressPrefixes\": [ \"10.10.0.0/17\" ],\r\n \"fullyQualifiedDomainNames\": [ ],\r\n \"subscriptions\": [ ],\r\n \"networkSecurityPerimeters\": [ ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "409" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c5a86217-118a-45ee-be7c-0f21439ea64a" ], + "x-ms-correlation-request-id": [ "c5a86217-118a-45ee-be7c-0f21439ea64a" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134945Z:c5a86217-118a-45ee-be7c-0f21439ea64a" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/17\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "37" ], + "x-ms-client-request-id": [ "6bbaa98f-6bdb-4a4f-b1bb-af3bea5f0b40" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11978" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3f355cf0-76a0-4bff-9a30-2a90d6e7170a" ], + "x-ms-correlation-request-id": [ "3f355cf0-76a0-4bff-9a30-2a90d6e7170a" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134945Z:3f355cf0-76a0-4bff-9a30-2a90d6e7170a" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/17\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "38" ], + "x-ms-client-request-id": [ "1141f057-7849-4385-8505-1aebbc1ad62d" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11977" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "952b831e-321a-4b68-a125-ece5b4d34aad" ], + "x-ms-correlation-request-id": [ "952b831e-321a-4b68-a125-ece5b4d34aad" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134946Z:952b831e-321a-4b68-a125-ece5b4d34aad" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "474" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.10.0.0/17\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateViaIdentityExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview+3": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1?api-version=2021-02-01-preview", + "Content": "{\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\r\n \"properties\": {\r\n \"direction\": \"Inbound\",\r\n \"addressPrefixes\": [ \"10.0.0.0/16\" ],\r\n \"fullyQualifiedDomainNames\": [ ],\r\n \"subscriptions\": [ ],\r\n \"networkSecurityPerimeters\": [ ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "408" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ca8f1814-68ef-4590-834d-c3c2ddbfd337" ], + "x-ms-correlation-request-id": [ "ca8f1814-68ef-4590-834d-c3c2ddbfd337" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134947Z:ca8f1814-68ef-4590-834d-c3c2ddbfd337" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "473" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Inbound\",\"addressPrefixes\":[\"10.0.0.0/16\"],\"fullyQualifiedDomainNames\":[],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateViaIdentityExpandedFQDN+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "40" ], + "x-ms-client-request-id": [ "acb2db55-69da-4f5a-86c9-81a40152ca04" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11976" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3041123b-c52a-4e24-badb-43b76d287204" ], + "x-ms-correlation-request-id": [ "3041123b-c52a-4e24-badb-43b76d287204" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134947Z:3041123b-c52a-4e24-badb-43b76d287204" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "464" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Outbound\",\"addressPrefixes\":[],\"fullyQualifiedDomainNames\":[\"*\"],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateViaIdentityExpandedFQDN+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "41" ], + "x-ms-client-request-id": [ "c63511bf-fc31-4991-bc79-6d5ea0381a5f" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAccessRule_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11975" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "72db4218-0ed8-4622-aaac-a8ad9d7c71c2" ], + "x-ms-correlation-request-id": [ "72db4218-0ed8-4622-aaac-a8ad9d7c71c2" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134948Z:72db4218-0ed8-4622-aaac-a8ad9d7c71c2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "464" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Outbound\",\"addressPrefixes\":[],\"fullyQualifiedDomainNames\":[\"*\"],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAccessRule+[NoContext]+UpdateViaIdentityExpandedFQDN+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2?api-version=2021-02-01-preview+3": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2?api-version=2021-02-01-preview", + "Content": "{\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2\",\r\n \"properties\": {\r\n \"direction\": \"Outbound\",\r\n \"addressPrefixes\": [ ],\r\n \"fullyQualifiedDomainNames\": [ \"microsoft.com\", \"nsp.microsoft.com\" ],\r\n \"subscriptions\": [ ],\r\n \"networkSecurityPerimeters\": [ ]\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "432" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "fa9312ab-1944-46cb-9fe0-2b01d4186771" ], + "x-ms-correlation-request-id": [ "fa9312ab-1944-46cb-9fe0-2b01d4186771" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134949Z:fa9312ab-1944-46cb-9fe0-2b01d4186771" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "496" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"t-ar2\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile1/accessRules/t-ar2\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/profiles/accessRules\",\"properties\":{\"provisioningState\":\"Succeeded\",\"direction\":\"Outbound\",\"addressPrefixes\":[],\"fullyQualifiedDomainNames\":[\"microsoft.com\",\"nsp.microsoft.com\"],\"subscriptions\":[],\"networkSecurityPerimeters\":[]}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 new file mode 100644 index 000000000000..aaa4f8e93cbe --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAccessRule.Tests.ps1 @@ -0,0 +1,50 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzNetworkSecurityPerimeterAccessRule')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzNetworkSecurityPerimeterAccessRule.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzNetworkSecurityPerimeterAccessRule' { + It 'UpdateExpanded' { + { + + Update-AzNetworkSecurityPerimeterAccessRule -Name $env.tmpAccessRule1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 -ProfileName $env.tmpProfile1 -AddressPrefix @('10.10.0.0/17') + + } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' { + { + # this test case is dependent on the above test case + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name $env.tmpAccessRule1 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 -ProfileName $env.tmpProfile1 + + $UpdateObj = Update-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj -AddressPrefix @('10.0.0.0/16') + + $UpdateObj.addressPrefix | Should -Be @('10.0.0.0/16') + + } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpandedFQDN' { + { + # this test case is dependent on the above test case + $GETObj = Get-AzNetworkSecurityPerimeterAccessRule -Name $env.tmpAccessRule2 -ResourceGroupName $env.rgname -SecurityPerimeterName $env.tmpNsp1 -ProfileName $env.tmpProfile1 + + $UpdateObj = Update-AzNetworkSecurityPerimeterAccessRule -InputObject $GETObj -FullyQualifiedDomainName @('microsoft.com', 'nsp.microsoft.com') + + $UpdateObj.fullyQualifiedDomainName | Should -Be @('microsoft.com', 'nsp.microsoft.com') + + } | Should -Not -Throw + } + +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Recording.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Recording.json new file mode 100644 index 000000000000..6c4021bbe986 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Recording.json @@ -0,0 +1,238 @@ +{ + "Update-AzNetworkSecurityPerimeterAssociation+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "43" ], + "x-ms-client-request-id": [ "5e11ee93-cf3b-48a9-90df-781a7d1f132b" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11974" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "bf56a47a-5dae-4b1e-a2bc-82c1a3974ac2" ], + "x-ms-correlation-request-id": [ "bf56a47a-5dae-4b1e-a2bc-82c1a3974ac2" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134950Z:bf56a47a-5dae-4b1e-a2bc-82c1a3974ac2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "759" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Learning\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAssociation+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "44" ], + "x-ms-client-request-id": [ "b77ffdca-cfe0-47c5-8839-2dd521e2ff2d" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11973" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f4639566-71d0-46d0-9bd1-91876fb00ea4" ], + "x-ms-correlation-request-id": [ "f4639566-71d0-46d0-9bd1-91876fb00ea4" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134950Z:f4639566-71d0-46d0-9bd1-91876fb00ea4" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "759" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Learning\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAssociation+[NoContext]+UpdateExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+3": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": "{\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\r\n \"properties\": {\r\n \"privateLinkResource\": {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"\r\n },\r\n \"profile\": {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"\r\n },\r\n \"accessMode\": \"Enforced\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "667" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "59d3d35b-7f5c-468d-871e-7f967fa610c5" ], + "x-ms-correlation-request-id": [ "59d3d35b-7f5c-468d-871e-7f967fa610c5" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134951Z:59d3d35b-7f5c-468d-871e-7f967fa610c5" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "758" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Accepted\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAssociation+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "46" ], + "x-ms-client-request-id": [ "3e33cd0c-cef1-4bea-8bb3-9a1c6245d037" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11972" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7fd4d4a4-fb7b-4082-a447-3d4698f7fd54" ], + "x-ms-correlation-request-id": [ "7fd4d4a4-fb7b-4082-a447-3d4698f7fd54" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134952Z:7fd4d4a4-fb7b-4082-a447-3d4698f7fd54" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "759" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAssociation+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": null, + "isContentBase64": false, + "Headers": { + "x-ms-unique-id": [ "47" ], + "x-ms-client-request-id": [ "4aab2d60-fc28-498b-868f-528a0aca450e" ], + "CommandName": [ "Get-AzNetworkSecurityPerimeterAssociation" ], + "FullCommandName": [ "Get-AzNetworkSecurityPerimeterAssociation_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/v8.0.0", "PSVersion/v7.2.5", "Az.NetworkSecurityPerimeter/0.1.0" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11971" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "341fbc5b-6fee-42e8-82b2-482756b5f9dc" ], + "x-ms-correlation-request-id": [ "341fbc5b-6fee-42e8-82b2-482756b5f9dc" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134953Z:341fbc5b-6fee-42e8-82b2-482756b5f9dc" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "759" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Enforced\",\"provisioningState\":\"Succeeded\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + }, + "Update-AzNetworkSecurityPerimeterAssociation+[NoContext]+UpdateViaIdentityExpanded+$PUT+https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview+3": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1?api-version=2021-02-01-preview", + "Content": "{\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\r\n \"properties\": {\r\n \"privateLinkResource\": {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"\r\n },\r\n \"profile\": {\r\n \"id\": \"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"\r\n },\r\n \"accessMode\": \"Learning\"\r\n }\r\n}", + "isContentBase64": false, + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "667" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b89b09cd-a07d-4a35-bd1d-013ec70669bf" ], + "x-ms-correlation-request-id": [ "b89b09cd-a07d-4a35-bd1d-013ec70669bf" ], + "x-ms-routing-request-id": [ "CENTRALINDIA:20220819T134953Z:b89b09cd-a07d-4a35-bd1d-013ec70669bf" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Fri, 19 Aug 2022 13:49:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "758" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"psassociation1\",\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/resourceAssociations/psassociation1\",\"type\":\"Microsoft.Network/networkSecurityPerimeters/resourceAssociations\",\"properties\":{\"privateLinkResource\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.KeyVault/vaults/tiywst-paas4Rp\"},\"profile\":{\"id\":\"/subscriptions/3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9/resourceGroups/kumarkaushal-PS-RG-1/providers/Microsoft.Network/networkSecurityPerimeters/tiywst-nsp1/profiles/t-profile2\"},\"accessMode\":\"Learning\",\"provisioningState\":\"Accepted\",\"hasProvisioningIssues\":\"no\"}}", + "isContentBase64": false + } + } +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Tests.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Tests.ps1 new file mode 100644 index 000000000000..a95210d507ed --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/Update-AzNetworkSecurityPerimeterAssociation.Tests.ps1 @@ -0,0 +1,41 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzNetworkSecurityPerimeterAssociation')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzNetworkSecurityPerimeterAssociation.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzNetworkSecurityPerimeterAssociation' { + It 'UpdateExpanded' { + { + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name $env.association1 -SecurityPerimeterName $env.tmpNsp1 -ResourceGroupName $env.rgname + + $UpdateObj = Update-AzNetworkSecurityPerimeterAssociation -Name $env.association1 -SecurityPerimeterName $env.tmpNsp1 -ResourceGroupName $env.rgname -AccessMode $env.accessMode2 + + $UpdateObj.accessMode | Should -Be $env.accessMode2 + + } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' { + { + #$PSDefaultParameterValues['Disabled'] = $true + + $GETObj = Get-AzNetworkSecurityPerimeterAssociation -Name $env.association1 -SecurityPerimeterName $env.tmpNsp1 -ResourceGroupName $env.rgname + + $UpdateObj = Update-AzNetworkSecurityPerimeterAssociation -InputObject $GETObj -AccessMode $env.accessMode1 + + $UpdateObj.accessMode | Should -Be $env.accessMode1 + + } | Should -Not -Throw + } +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/env.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/env.json new file mode 100644 index 000000000000..784bfecffe0c --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/env.json @@ -0,0 +1,42 @@ +{ + "rgname": "kumarkaushal-PS-RG-1", + "tmpNspDelete2": "tiywst-nspD2", + "arDirection2": "OutBound", + "tmpAssociationDelete1": "t-asnD1", + "accessMode1": "Learning", + "accessrule2": "psaccessrule2", + "tmpPaas1Rp": "tiywst-paas1Rp", + "association2": "psassociation2", + "tmpAssociation1": "t-asn1", + "accessrule3": "psaccessrule3", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tmpAssociationDelete2": "t-asnD2", + "tmpPaas3Rp": "tiywst-paas3Rp", + "tmpProfileDelBase1": "t-prDelB1", + "tmpProfileDelBase2": "t-prDelB2", + "tmpProfile3": "t-profile3", + "tmpPaas2Rp": "tiywst-paas2Rp", + "RandomStr": "tiyws", + "tmpAccessRule2": "t-ar2", + "profile1": "psprofile1", + "tmpProfileDelete1": "t-profileD1", + "tmpProfile2": "t-profile2", + "tmpPaas4Rp": "tiywst-paas4Rp", + "nsp1": "psnsp1", + "profile2": "psprofile1", + "location": "eastus2euap", + "tmpNspDelete1": "tiywst-nspD1", + "SubscriptionId": "3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9", + "tmpAccessRuleDelete1": "t-arD1", + "arDirection1": "Inbound", + "accessrule1": "psaccessrule1", + "tmpNsp1": "tiywst-nsp1", + "accessMode2": "Enforced", + "tmpProfile1": "t-profile1", + "tmpAccessRuleDelete2": "t-arD2", + "association1": "psassociation1", + "tmpNspDelBase1": "tiywst-nspDelB1", + "tmpAccessRule1": "t-ar1", + "nsp2": "psnsp2", + "tmpProfileDelete2": "t-profileD2" +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/loadEnv.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/loadEnv.ps1 new file mode 100644 index 000000000000..5f079e89615e --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/loadEnv.ps1 @@ -0,0 +1,29 @@ +# ---------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code +# is regenerated. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/localEnv.json b/src/Network/NetworkSecurityPerimeter.Autorest/test/localEnv.json new file mode 100644 index 000000000000..784bfecffe0c --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/localEnv.json @@ -0,0 +1,42 @@ +{ + "rgname": "kumarkaushal-PS-RG-1", + "tmpNspDelete2": "tiywst-nspD2", + "arDirection2": "OutBound", + "tmpAssociationDelete1": "t-asnD1", + "accessMode1": "Learning", + "accessrule2": "psaccessrule2", + "tmpPaas1Rp": "tiywst-paas1Rp", + "association2": "psassociation2", + "tmpAssociation1": "t-asn1", + "accessrule3": "psaccessrule3", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tmpAssociationDelete2": "t-asnD2", + "tmpPaas3Rp": "tiywst-paas3Rp", + "tmpProfileDelBase1": "t-prDelB1", + "tmpProfileDelBase2": "t-prDelB2", + "tmpProfile3": "t-profile3", + "tmpPaas2Rp": "tiywst-paas2Rp", + "RandomStr": "tiyws", + "tmpAccessRule2": "t-ar2", + "profile1": "psprofile1", + "tmpProfileDelete1": "t-profileD1", + "tmpProfile2": "t-profile2", + "tmpPaas4Rp": "tiywst-paas4Rp", + "nsp1": "psnsp1", + "profile2": "psprofile1", + "location": "eastus2euap", + "tmpNspDelete1": "tiywst-nspD1", + "SubscriptionId": "3846cb0f-4afa-47ee-8ea4-1c8449c8c8d9", + "tmpAccessRuleDelete1": "t-arD1", + "arDirection1": "Inbound", + "accessrule1": "psaccessrule1", + "tmpNsp1": "tiywst-nsp1", + "accessMode2": "Enforced", + "tmpProfile1": "t-profile1", + "tmpAccessRuleDelete2": "t-arD2", + "association1": "psassociation1", + "tmpNspDelBase1": "tiywst-nspDelB1", + "tmpAccessRule1": "t-ar1", + "nsp2": "psnsp2", + "tmpProfileDelete2": "t-profileD2" +} diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/test/utils.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/test/utils.ps1 new file mode 100644 index 000000000000..738d1b60a817 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/test/utils.ps1 @@ -0,0 +1,227 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} + +$env = @{} +$templateVariables = @{} +if ($UsePreviousConfigForRecord) { + $previousEnv = Get-Content (Join-Path $PSScriptRoot 'env.json') | ConvertFrom-Json + $previousEnv.psobject.properties | Foreach-Object { $env[$_.Name] = $_.Value } +} +# Add script method called AddWithCache to $env, when useCache is set true, it will try to get the value from the $env first. +# example: $val = $env.AddWithCache('key', $val, $true) +$env | Add-Member -Type ScriptMethod -Value { param( [string]$key, [object]$val, [bool]$useCache) if ($this.Contains($key) -and $useCache) { return $this[$key] } else { $this[$key] = $val; return $val } } -Name 'AddWithCache' +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + + $randomString = "t" + (RandomString -allChars $false -len 4) + + $envFilePath = (Join-Path $PSScriptRoot $envFile) + + $nspKeyValues = Get-Content $envFilePath | ConvertFrom-Json -AsHashtable + + foreach ($item in $nspKeyValues.GetEnumerator()) { + if ($env.Contains($item.Name)) { + $env.($item.Name) = $item.Value + }else{ + $env.Add($item.Name, $item.Value) + } + } + $env.randomStr = $randomString + + #Create variable for template + $tmpNsp1 = $randomString + 't-nsp1' + $tmpNspDelBase1 = $randomString + 't-nspDelB1' + $tmpNspDelete1 = $randomString + 't-nspD1' + $tmpNspDelete2 = $randomString + 't-nspD2' + $tmpProfile1 = 't-profile1' + $tmpProfile2 = 't-profile2' + $tmpProfile3 = 't-profile3' + $tmpProfileDelete1 = 't-profileD1' + $tmpProfileDelete2 = 't-profileD2' + $tmpProfileDelBase1 = 't-prDelB1' + $tmpProfileDelBase2 = 't-prDelB2' + $tmpAccessRule1 = 't-ar1' + $tmpAccessRule2 = 't-ar2' + $tmpAccessRuleDelete1 = 't-arD1' + $tmpAccessRuleDelete2 = 't-arD2' + $tmpAssociation1 = 't-asn1' + $tmpAssociationDelete1 = 't-asnD1' + $tmpAssociationDelete2 = 't-asnD2' + $tmpPaas1Rp = $randomString + 't-paas1Rp' + $tmpPaas2Rp = $randomString + 't-paas2Rp' + $tmpPaas3Rp = $randomString + 't-paas3Rp' + $tmpPaas4Rp = $randomString + 't-paas4Rp' + + $tmpKeys = 'tmpNsp1','tmpNspDelBase1', 'tmpProfile1', 'tmpProfile2', 'tmpProfile3', 'tmpProfileDelBase1', 'tmpProfileDelBase2', 'tmpAccessRule1', 'tmpAccessRule2', 'tmpAccessRuleDelete1','tmpAccessRuleDelete2', 'tmpAssociation1', 'tmpAssociationDelete1', 'tmpAssociationDelete2', 'tmpPaas1Rp', 'tmpPaas2Rp','tmpPaas3Rp', 'tmpPaas4Rp','tmpProfileDelete1', 'tmpProfileDelete2', 'tmpNspDelete1', 'tmpNspDelete2' + $tmpValues = $tmpNsp1, $tmpNspDelBase1, $tmpProfile1, $tmpProfile2, $tmpProfile3, $tmpProfileDelBase1, $tmpProfileDelBase2, $tmpAccessRule1, $tmpAccessRule2, $tmpAccessRuleDelete1, $tmpAccessRuleDelete2, $tmpAssociation1, $tmpAssociationDelete1, $tmpAssociationDelete2, $tmpPaas1Rp, $tmpPaas2Rp,$tmpPaas3Rp, $tmpPaas4Rp, $tmpProfileDelete1, $tmpProfileDelete2, $tmpNspDelete1, $tmpNspDelete2 + + for ($i = 0; $i -le ($tmpKeys.length - 1); $i += 1) { + if ($env.Contains($tmpKeys[$i])) { + $env.($tmpKeys[$i]) = $tmpValues[$i] + }else{ + $env.Add($tmpKeys[$i], $tmpValues[$i]) + } + } + + Get-Content $envFilePath | ConvertFrom-Json -AsHashtable + + set-content -Path (Join-Path $PSScriptRoot 'env.json') -Value (ConvertTo-Json $env) + + set-content -Path (Join-Path $PSScriptRoot 'localEnv.json') -Value (ConvertTo-Json $env) + + Write-Host -ForegroundColor Magenta "Create resource group" + + # create resource group if it doesnt exists + New-AzResourceGroup -Name $env.rgname -Location $env.location + + Write-Host -ForegroundColor Magenta "Deploying template" + + + $templateInput = @{ + ResourceGroupName = $env.rgname + TemplateFile = ".\test\NSPTemplate.json" + nsp1Name = $env.tmpNsp1 + nspDelBase1Name = $env.tmpNspDelBase1 + nspDelete1Name = $env.tmpNspDelete1 + nspDelete2Name = $env.tmpNspDelete2 + profile1Name = $env.tmpProfile1 + profile2Name = $env.tmpProfile2 + profile3Name = $env.tmpProfile3 + profileDelete1Name = $env.tmpProfileDelete1 + profileDelete2Name = $env.tmpProfileDelete2 + profileDelBase1Name = $env.tmpProfileDelBase1 + profileDelBase2Name = $env.tmpProfileDelBase2 + accessRule1Name = $env.tmpAccessRule1 + accessRule2Name = $env.tmpAccessRule2 + accessRuleDelete1Name = $env.tmpAccessRuleDelete1 + accessRuleDelete2Name = $env.tmpAccessRuleDelete2 + paas1Name = $env.tmpPaas1Rp + paas2Name = $env.tmpPaas2Rp + paas3Name = $env.tmpPaas3Rp + paas4Name = $env.tmpPaas4Rp + association1Name = $env.tmpAssociation1 + associationDelete1Name = $env.tmpAssociationDelete1 + associationDelete2Name = $env.tmpAssociationDelete2 + } + + #deploy template + $templateOutput = New-AzResourceGroupDeployment @templateInput + + Write-Host -ForegroundColor Magenta "Template deployed" + +} +function cleanupEnv() { + + # Clean resources you create for testing + + Write-Host -ForegroundColor Magenta "Removing associations" + + + # Remove associations + $remove_association1 = @{ + SecurityPerimeterName = $env.tmpNsp1 + ResourceGroupName = $env.rgname + Name = $env.tmpAssociation1 + } + + Remove-AzNetworkSecurityPerimeterAssociation @remove_association1 + + + $remove_associationDelete1 = @{ + SecurityPerimeterName = $env.tmpNspDelBase1 + ResourceGroupName = $env.rgname + Name = $env.tmpAssociationDelete1 + } + + Remove-AzNetworkSecurityPerimeterAssociation @remove_associationDelete1 + + $remove_associationDelete2 = @{ + SecurityPerimeterName = $env.tmpNspDelBase1 + ResourceGroupName = $env.rgname + Name = $env.tmpAssociationDelete2 + } + + Remove-AzNetworkSecurityPerimeterAssociation @remove_associationDelete2 + + + #Remove association created by testcase + $remove_association2 = @{ + SecurityPerimeterName = $env.tmpNsp1 + ResourceGroupName = $env.rgname + Name = $env.association1 + } + + + Remove-AzNetworkSecurityPerimeterAssociation @remove_association2 + + Write-Host -ForegroundColor Magenta "Done" + + + $isDeleted = $false + + While(-Not $isDeleted){ + $isDeleted = $true + + Write-Host -ForegroundColor Magenta "Sleep 20" + + Start-Sleep -Seconds 20 + + try{ + $isDeleted = $false + Get-AzNetworkSecurityPerimeterAssociation @remove_association1 + continue + } + catch{ + $isDeleted = $true + } + + try{ + $isDeleted = $false + Get-AzNetworkSecurityPerimeterAssociation @remove_associationDelete1 + continue + } + catch{ + $isDeleted = $true + } + + try{ + $isDeleted = $false + Get-AzNetworkSecurityPerimeterAssociation @remove_associationDelete2 + continue + } + catch{ + $isDeleted = $true + } + + try{ + $isDeleted = $false + Get-AzNetworkSecurityPerimeterAssociation @remove_association2 + continue + } + catch{ + $isDeleted = $true + } + + } + + Write-Host -ForegroundColor Magenta "Removing RG" + + #Remove resourceGroup + Remove-AzResourceGroup -Name $env.rgname + + Write-Host -ForegroundColor Magenta "Removed RG" +} + diff --git a/src/Network/NetworkSecurityPerimeter.Autorest/utils/Unprotect-SecureString.ps1 b/src/Network/NetworkSecurityPerimeter.Autorest/utils/Unprotect-SecureString.ps1 new file mode 100644 index 000000000000..cb05b51a6220 --- /dev/null +++ b/src/Network/NetworkSecurityPerimeter.Autorest/utils/Unprotect-SecureString.ps1 @@ -0,0 +1,16 @@ +#This script converts securestring to plaintext + +param( + [Parameter(Mandatory, ValueFromPipeline)] + [System.Security.SecureString] + ${SecureString} +) + +$ssPtr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) +try { + $plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($ssPtr) +} finally { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ssPtr) +} + +return $plaintext \ No newline at end of file