#WAF Adding WAF support to PowerShell#3678
Conversation
…convertion error, removed shouldProcess from WAF, enhanced WAF/ConnectionDraining Set... cmdlets.
|
@jobatzil, |
cormacpayne
left a comment
There was a problem hiding this comment.
@jobatzil Hey Johannes, a couple of comments that need to be resolved
| <Reference Include="Microsoft.Azure.Management.Network, Version=9.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
| <HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.9.1.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath> | ||
| <Reference Include="Microsoft.Azure.Management.Network, Version=9.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
| <HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.9.2.0-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath> |
| @@ -7,7 +7,7 @@ | |||
| <package id="Microsoft.Azure.Graph.RBAC" version="3.2.0-preview" targetFramework="net45" /> | |||
| <package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" /> | |||
| <package id="Microsoft.Azure.Management.Compute" version="14.0.0-prerelease" targetFramework="net45" /> | |||
| <package id="Microsoft.Azure.Management.Network" version="9.1.0-preview" targetFramework="net45" /> | |||
| <package id="Microsoft.Azure.Management.Network" version="9.2.0-preview" targetFramework="net45" /> | |||
| Mandatory = true, | ||
| HelpMessage = "The version of the rule set type.")] | ||
| [ValidateNotNullOrEmpty] | ||
| public string RuleSetVersion { get; set; } |
There was a problem hiding this comment.
@jobatzil adding parameters RuleSetType and RuleSetVersion that are mandatory is a breaking change - existing scripts that use these cmdlets will not work
There was a problem hiding this comment.
Yes, it is also mandatory in the new azure-sdk
| @@ -17,24 +17,24 @@ | |||
|
|
|||
| namespace Microsoft.Azure.Commands.Network | |||
| { | |||
| [Cmdlet(VerbsCommon.New, "AzureRmApplicationGatewayWebApplicationFirewallConfiguration", SupportsShouldProcess = true), | |||
There was a problem hiding this comment.
it only changes the local object, it shouldn't have been there in the first place.
| @@ -17,7 +17,7 @@ | |||
|
|
|||
| namespace Microsoft.Azure.Commands.Network | |||
| { | |||
| [Cmdlet(VerbsCommon.Set, "AzureRmApplicationGatewayWebApplicationFirewallConfiguration", SupportsShouldProcess = true), | |||
| [Parameter( | ||
| Mandatory = false, | ||
| HelpMessage = "The list of rules that will be disabled. If null, all rules of the rule group will be disabled.")] | ||
| public List<int> Rules { get; set; } |
There was a problem hiding this comment.
@jobatzil according to PowerShell Strongly Encouraged Development Guidelines, parameter nouns should be singular:
Avoid using plural names for parameters whose value is a single element. This includes parameters that take arrays or lists because the user might supply an array or list with only one element.
Let's think of a different noun that can be used instead of Rules. How does RuleList work?
There was a problem hiding this comment.
Hmm, this is the name we use on every level (powershell, azure-ask, backend)
There was a problem hiding this comment.
I will leave it like that to keep it consistent.
|
|
||
| namespace Microsoft.Azure.Commands.Network | ||
| { | ||
| [Cmdlet(VerbsCommon.New, "AzureRmApplicationGatewayFirewallDisabledRuleGroupConfig"), |
There was a problem hiding this comment.
@jobatzil I'm worried that the name of this cmdlet is too long. Is there any way we can keep the name, but add an alias to something shorter?
There was a problem hiding this comment.
As discussed offline, there is no shorter name that still matches our current pattern. We are actually thinking of introducing shorter aliases for all of the cmdlets (agw instead of applicationGateway?), this will not be part of this PR though.
| public List<PSApplicationGatewayFirewallRuleSet> Value { get; set; } | ||
|
|
||
| [JsonIgnore] | ||
| public string ValueText |
There was a problem hiding this comment.
@jobatzil for each of the classes you are adding to the Model folder, can you make sure that each of their properties have corresponding help with them?
/// <summary>
/// Brief summary of property.
/// </summary>
public string ValueText
{
...
}There was a problem hiding this comment.
We've never done that before, but I can do that.
| @@ -30,6 +30,13 @@ public ApplicationGatewayTests(ITestOutputHelper output) | |||
|
|
|||
| [Fact] | |||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | |||
| public void TestAvailableWafRuleSets() | |||
| { | |||
| NetworkResourcesController.NewInstance.RunPsTest(string.Format("Test-AvailableWafRuleSets -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory)); | |||
There was a problem hiding this comment.
@jobatzil was there a test recording file associated with this test? I didn't see one. If so, make sure it is added in the test csproj file.
There was a problem hiding this comment.
yes, but it is not uploaded yet, I may change the cmdlet before it gets finalized.
There was a problem hiding this comment.
I uploaded the test recordings.
…ilableWafRuleSets test recordings and and alias. Added StartUp script for network.
…eSets to the notes section in the markdown file.
|
@cormacpayne I didn't update the TestApplicationGatewayCRUD test recordings yet. |
Description
Add support of newest WAF functionality to PowerShell.
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcessand haveSupportShouldProcess=truespecified in the cmdlet attribute. You can find more information onShouldProcesshere.OutputTypeattribute if any output is produced - if the cmdlet produces no output, it should implement aPassThruparameter.Cmdlet Parameter Guidelines