none
Virtual Network Classic vs. New Portal & PowerShell: Potential Software Bug: Download network configuration (or netcfg) file via PowerShell command Get-AzureVNetConfig RRS feed

  • Question

  • Virtual Network Classic vs. New Portal & PowerShell: Download network configuration (or netcfg) file via PowerShell command Get-AzureVNetConfig

    Today I created two basic but separate Virtual Networks in Azure.

    The first was using the classic portal: kw-VirtualNetworkClassic

    Here is the second in the new portal (notice the classic VN does not show up on this screen even after refresh)

    Problem: When I use power shell to download the network configuration file:

    Get-AzureVNetConfig -ExportToFile c:\azure\NetworkConfig.xml

    I get only results and configuration for the classic virtual network only in my XML file.

    So earlier I found out that I could not use the new Azure portal to create a VN and then subsequently download my Virtual Network configuration file through PowerShell. Downloading the file would be the first step to automating creation of new VN's, etc.. etc.. I created another question earlier and is available on this topic thread:

    Cannot Download network configuration (or netcfg) file via PowerShell command Get-AzureVNetConfig 

    The only way to obtain a network configuration file for an Azure Virtual Network seems to be creating it through the classic portal only... 

    Sunday, November 26, 2017 2:54 AM

Answers

  • You’re right but this is by design and not a bug. The network configuration file is only meant to be used with VNets deployed in the Classic model. Since your VNet ‘kw-myVirtualNetwork’ is ARM-based you’ll not need a netcfg file.

    Also, the classic VNet won’t show up if you select ‘Virtual networks’ from the Azure Portal. To view classic VNets you’ll have to select ‘Virtual networks (classic)’. Again, this is because of the differences in the model which is used for deployment.

    For automating creation of new resources you can look at the ARM templates. Here’s a good starting point for ARM based VNets.

    Create a virtual network using an Azure Resource Manager template

    -----------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    • Proposed as answer by Md Shihab Sunday, November 26, 2017 6:21 AM
    • Marked as answer by Kathleen W Monday, November 27, 2017 11:05 PM
    Sunday, November 26, 2017 6:21 AM

All replies

  • Cannot Download network configuration (or netcfg) file via PowerShell command Get-AzureVNetConfig 

    I created a virtual network called kw-myVirtualNetwork with the basic defaults. It's a personal Virtual Network that is unmodified from the basic template. Important: It exists under my Azure portal as a Virtual Network and belonging to my Resource Group.

    I am trying to obtain the network configuration (or netcfg) file via PowerShell command Get-AzureVNetConfig with this command (I've added the Debug stuff to get more insight):

    Get-AzureVNetConfig -ExportToFile c:\azure\NetworkConfig.xml -Debug -Verbose

    Problem: The file NetworkConfig.xml never gets downloaded. Yes there is already an c:\azure directory but no file gets downloaded. Yes I already logged in to Azure through PowerShell.

    Results: No file is downloaded. Any meaningful help or insight would be appreciated.

    Here is my (edited ...) debug output:

     

    PS C:\Users\KathleenWest> Get-AzureVNetConfig -ExportToFile c:\azure\NetworkConfig.xml -Debug -Verbose


    HTTP Method:
    GET

    Absolute Uri:
    https://management.core.windows.net/.......

    Headers:
    x-ms-version                  : 2017-01-01

    Body:



    DEBUG: ============================ HTTP RESPONSE ============================

    Status Code:
    NotFound

    Headers:
    x-ms-servedbyregion           : ussouth3
    Strict-Transport-Security     : max-age=31536000; includeSubDomains
    x-ms-request-id               : ......
    Cache-Control                 : no-cache
    Date                          : Sat, 25 Nov 2017 21:40:21 GMT
    Server                        : .......

    Body:
    <Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <Code>ResourceNotFound</Code>
      <Message>Network configuration does not exist.</Message>
    </Error>


    Get-AzureVNetConfig : ResourceNotFound: Network configuration does not exist.
    At line:1 char:1
    + Get-AzureVNetConfig -ExportToFile c:\azure\NetworkConfig.xml -Debug - ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Get-AzureVNetConfig], CloudException
        + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVNetConfigCommand

    DEBUG: AzureQoSEvent: CommandName - Get-AzureVNetConfig; IsSuccess - False; Duration - 00:00:12.7059189; Exception - Hyak.Com
    mon.CloudException: ResourceNotFound: Network configuration does not exist.
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
       at Microsoft.WindowsAzure.Management.Network.NetworkOperationsExtensions.GetConfiguration(INetworkOperations operations)
       at Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVNetConfigCommand.<>c__DisplayClass4_0.<GetVirtualNetwor
    kConfigProcess>b__0();
    DEBUG: Finish sending metric.
    DEBUG: 4:40:29 PM - GetAzureVNetConfigCommand end processing.
    DEBUG: 4:40:29 PM - GetAzureVNetConfigCommand end processing.


     

    • Merged by Md Shihab Sunday, November 26, 2017 6:23 AM Same question
    Saturday, November 25, 2017 9:59 PM
  • I think this may be a software bug. I discovered something interesting and created a separate but related question.

    Virtual Network Classic vs. New Portal & PowerShell: Potential Software Bug: Download network configuration (or netcfg) file via PowerShell command Get-AzureVNetConfig

    Sunday, November 26, 2017 2:56 AM
  • You’re right but this is by design and not a bug. The network configuration file is only meant to be used with VNets deployed in the Classic model. Since your VNet ‘kw-myVirtualNetwork’ is ARM-based you’ll not need a netcfg file.

    Also, the classic VNet won’t show up if you select ‘Virtual networks’ from the Azure Portal. To view classic VNets you’ll have to select ‘Virtual networks (classic)’. Again, this is because of the differences in the model which is used for deployment.

    For automating creation of new resources you can look at the ARM templates. Here’s a good starting point for ARM based VNets.

    Create a virtual network using an Azure Resource Manager template

    -----------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    • Proposed as answer by Md Shihab Sunday, November 26, 2017 6:21 AM
    • Marked as answer by Kathleen W Monday, November 27, 2017 11:05 PM
    Sunday, November 26, 2017 6:21 AM
  • I think you are right in your solution based on the results I observed and the documentation your solution referenced. From my class I was under the impression that this PowerShell process/technique worked on downloading/creating VNs with the new portal. I will follow-up with the instructor on the errata for him to correct this.

    Suggestion: If there is a way to update the PowerShell documentation to clarify this command works only on VNs with the classic portal only can someone update that? Or maybe I missed it? 

    Thanks for your help

    Monday, November 27, 2017 11:10 PM
  • You can create classic resources from the new portal as well. It is important to understand the two models of Azure deployment that are available: ARM and Classic (aka ASM): with the recommendation being to go with ARM deployments as this is where Azure is headed for the long term.

    You give a good suggestion about updating the docs and we’ll take a look at that.

    In essence, you can download the netcfg file for classic VNets deployed using the new portal. Like I said, the portal can be new but the main thing to look for is the deployment model you choose i.e. ARM or Classic.

    Hope this helps. Feel free to ask if you still have any questions.

    -----------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Tuesday, November 28, 2017 6:17 AM