Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

francedot
Copy link
Contributor

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.

Copy link
Collaborator

@petehauge petehauge left a 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")]
Copy link
Collaborator

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
Copy link
Collaborator

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) {
Copy link
Collaborator

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 { .... }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants