-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add get dtl VNet function #664
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.