< Back

New-AzureRmApiManagementVirtualNetwork

Tue Jan 29, 2019 9:30 pm

NAME New-AzureRmApiManagementVirtualNetwork



SYNOPSIS

Creates an instance of PsApiManagementVirtualNetwork.





SYNTAX

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

[<CommonParameters>]





DESCRIPTION

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

used with Update-AzureRmApiManagementDeployment cmdlet.





PARAMETERS

-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Location <String>

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



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SubnetResourceId <String>

Specifies the subnet resource ID of the virtual network.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.ApiManagement.Models.PsApiManagementVirtualNetwork







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ualnetwork

Update-AzureRmApiManagementDeployment