Conversation
petehauge
left a comment
There was a problem hiding this comment.
Good work, thanks for contributing! Just a few comments, and please add tests to verify getting the VNet & ExpandResource. Thanks!
| [ValidateNotNullOrEmpty()] | ||
| $Lab, | ||
|
|
||
| [parameter(Mandatory=$false, ValueFromPipeline=$true, HelpMessage="If set, get the Expanded Resource from the std VNet object")] |
There was a problem hiding this comment.
Should this be a value from the pipeline? I think only the Lab would be brought in via the pipeline?
|
|
||
| if ($ExpandResource) { | ||
| foreach($dtlLabVNet in $dtlLabVNets) { | ||
| Get-AzureRmVirtualNetwork -ResourceGroupName $dtlLabVNet.ResourceGroupName -Name $dtlLabVNet.Name -ExpandResource $ExpandResource |
There was a problem hiding this comment.
If ExpandResource isn't passed in - does anything get returned from this commandlet? I would think we should have the Lab VNets always returned, and if ExpandResource is passed in, we can inject another property that contains the underlying VNet resource? There's an example for Getting VMs & Extended status in the library...
| -ApiVersion 2018-09-15 | ||
|
|
||
| if ($ExpandResource) { | ||
| foreach($dtlLabVNet in $dtlLabVNets) { |
There was a problem hiding this comment.
Can use a more PowerShell-like syntax here like $dtlLabVNets | ForEach-Object { .... }
Get-AzDtlVirtualNetworks:
Gets the Microsoft.DevTestLab/labs/virtualnetworks object.
If ExpandResource is set, it gets the full Microsoft.Network/virtualNetworks with the ExpandResource:
e.g.
Get-AzDtlVirtualNetworks -Lab $dtlLab -ExpandResource 'subnets/ipConfigurations'gets the full subnets list along with the assigned NIC IPs.