NetworkProfile output from Get-AzureRMVM is not directly useful to get NetworkInterface
Cmdlet(s)
Get-AzrueRMVM
PowerShell Version
PSVersion 5.1.15063.296
Module Version
3.3.1 AzureRM.Compute
OS Version
10.0.15063.296
Description
The "NetworkProfile" prooperty from Get-AzureRMVM is too difficult to use.
The output is only the a collection of items containing the ResourceID of the Network Interface. This output cannot be directly consumed by other functions such as Get-AzureRMNetworkInterface as that function does not support a ResourceId parameter.
Using the output requires (obviously) either parsing the ResourceId to find the ResourceGroup and Name values or and additional invocation of Find-AzureRMResource.
Neither of these steps should be necessary - especially when the main use is likely to simply be to find the IP address used by the interface.
Debug Output
N/A
Script/Steps for Reproduction
$vm = Get-AzureRMVM -ResourceGroupName myRGName -Name myVMName $vm.NetworkProfile
@DeepakRajendranMsft Hey Deepak, it looks like the request is to add a parameter set to the Get-AzureRmNetworkInterface cmdlet that accepts a ResourceId so they can pipe the result of (Get-AzureRmVM -Name $VM -ResourceGroupName $RG).NetworkProfile to the cmdlet.
@praries880 would you mind handling this issue when you have time? Let me know if you'd like me to reassign this to someone else.
Core issue here is not in Get-AzureRmVm, thr issue is in the Get-AzureRMNetworkInterface cmdlet. Get-AzureRMNetworkInterface should have a param set that takesn in a resource Id and returns the network interface for the provided resource ID.
@MikhailTryakhov can you take a look?
The API Spec itself does not seem to support getting a network interface using a resource ID. The cmdlet however could try and parse the passed in resource Id to get the RG name and resource name to then call the get operation with RG name and resource name.
Added ResourceId parameter to Get-NIC to allow getting it using Id only