PSRule.Rules.Azure icon indicating copy to clipboard operation
PSRule.Rules.Azure copied to clipboard

Added Azure.VM.ASDistributeTraffic

Open BenjaminEngeset opened this issue 1 year ago • 4 comments

PR Summary

Fixes #67

Added Azure.VM.ASDistributeTraffic.

PR Checklist

  • [x] PR has a meaningful title
  • [x] Summarized changes
  • [x] Change is not breaking
  • [x] This PR is ready to merge and is not Work in Progress
  • Rule changes
    • [x] Unit tests created/ updated
    • [x] Rule documentation created/ updated
    • [x] Link to a filed issue
    • [x] Change log has been updated with change under unreleased section
  • Other code changes
    • [ ] Unit tests created/ updated
    • [ ] Link to a filed issue
    • [ ] Change log has been updated with change under unreleased section

BenjaminEngeset avatar Aug 15 '24 20:08 BenjaminEngeset

Ready for review, @BernieWhite.

This one is a bit special, as in all honesty, configuring virtual network card interfaces within the resource itself is not so common and should not be recommended really. Cannot even decide the full name for the NIC. It's not possible to configure properties.networkProfile.networkInterfaceConfigurations and properties.networkProfile.networkInterfaces at the same time within a template either.

After the deployment by using properties.networkProfile.networkInterfaceConfigurations, the property is gone in the template and the properties.networkProfile.networkInterfaces is created with the NICs that the interface configuration created.

So the rule is not really that useful for scenarios when exporting.

Let me know what you think. This is not an ideal rule, but I think it's not possible to do anything else?

Update:

I am now a bit confused, since I see that GetSubResources -ResourceType 'Microsoft.Network/networkInterfaces' has been used in some rules. Since this neither is an child resource or an extension resource, it's still possible to get hold of it?

https://github.com/Azure/PSRule.Rules.Azure/blob/6d02f7b8c4747afe40713c5ab388ea1e2dcc74cb/src/PSRule.Rules.Azure/rules/Azure.Common.Rule.ps1#L101

BenjaminEngeset avatar Aug 15 '24 20:08 BenjaminEngeset

'Microsoft.Network/networkInterfaces'

Only for in-flight cases. But this rule is only going to be applicable for in-flight cases.

BernieWhite avatar Aug 19 '24 00:08 BernieWhite

'Microsoft.Network/networkInterfaces'

Only for in-flight cases. But this rule is only going to be applicable for in-flight cases.

Gotcha. Update from me soon, I will notify you when I am done.

BenjaminEngeset avatar Aug 19 '24 16:08 BenjaminEngeset

Ready for review @BernieWhite.

As it is now each IP configuration requires to reference a pool, otherwise it will fail.

The rule can also be designed so that one IP configuration referencing a pool is enough.

BenjaminEngeset avatar Aug 20 '24 18:08 BenjaminEngeset