New-AzureRmApiManagementVirtualNetwork

Creates an instance of PsApiManagementVirtualNetwork.

Syntax

New-AzureRmApiManagementVirtualNetwork
   -Location <String>
   -SubnetResourceId <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The New-AzureRmApiManagementVirtualNetwork cmdlet is a helper command to create an instance of PsApiManagementVirtualNetwork. This command is used with Update-AzureRmApiManagementDeployment cmdlet.

Examples

Example 1: Create a virtual network

PS C:\>$vnetName = "myvnet"
PS C:\>$subnetName = "default"
PS C:\>$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24
PS C:\>$vnet = New-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroupName -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet

# Create a Virtual Network Object
PS C:\>$virtualNetwork = New-AzureRmApiManagementVirtualNetwork -Location $location -SubnetResourceId $vnet.Subnets[0].Id

# Get the service
PS C:\>$service = Get-AzureRmApiManagement -ResourceGroupName $resourceGroupName -Name $apiManagementName    
PS C:\>$service.VirtualNetwork = $virtualNetwork
PS C:\>$service.VpnType = "External"

# Update the Deployment with Virtual Network
PS C:\>Update-AzureRmApiManagementDeployment -ApiManagement $service

This example creates a virtual network and then calls the Update-AzureRmApiManagementDeployment cmdlet.

Required Parameters

-Location

Specifies the location amongst the supported region for Api Management service. To obtain valid locations, use the cmdlet Get-AzureRmResourceProvider -ProviderNamespace "Microsoft.ApiManagement" | where {$_.ResourceTypes[0].ResourceTypeName -eq "service"} | Select-Object Locations

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SubnetResourceId

Specifies the subnet resource ID of the virtual network.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagementVirtualNetwork