0% found this document useful (0 votes)
9 views

Create Vnet With Encryption I Powershell

Uploaded by

Dario Baskarad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Create Vnet With Encryption I Powershell

Uploaded by

Dario Baskarad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

PS /home/dario> $rg =@{

>> Name = 'test-rg'


>> Location = 'eastus2'
>> }
PS /home/dario> New-AzResourceGroup test-RG

cmdlet New-AzResourceGroup at command pipeline position 1


Supply values for the following parameters:
(Type !? for Help.)
Location: eastUS2

Confirm
Provided resource group already exists. Are you sure you want to update it?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y

ResourceGroupName : test-rg
Location : eastus2
ProvisioningState : Succeeded
Tags :
ResourceId :
/subscriptions/34edd7d8-fefa-4ccd-823b-922a315156ca/resourceGroups/test-rg

PS /home/dario> ## Create backend subnet config ##


PS /home/dario> $subnet = @{
>> Name = 'subnet-1'
>> AddressPrefix = '10.0.0.0/24'
>> }
PS /home/dario> $subnetConfig = New-AzVirtualNetworkSubnetConfig @subnet
PS /home/dario>
PS /home/dario> ## Create the virtual network ##
PS /home/dario> $net = @{
>> Name = 'vnet-1'
>> ResourceGroupName = 'test-rg'
>> Location = 'eastus2'
>> AddressPrefix = '10.0.0.0/16'
>> Subnet = $subnetConfig
>> EnableEncryption = 'true'
>> EncryptionEnforcementPolicy = 'AllowUnencrypted'
>> }
PS /home/dario> New-AzVirtualNetwork @net

ResourceGroupName Name Location ProvisioningState EnableDdosProtection


----------------- ---- -------- ----------------- --------------------
test-rg vnet-1 eastus2 Succeeded False

PS /home/dario> ## Place the virtual network configuration into a variable. ##


PS /home/dario> $net = @{
>> Name = 'vnet-1'
>> ResourceGroupName = 'test-rg'
>> }
PS /home/dario> $vnet = Get-AzVirtualNetwork @net
PS /home/dario>
PS /home/dario> ## Enable encryption on the virtual network ##
PS /home/dario> $vnet.Encryption = @{
>> Enabled = 'true'
>> Enforcement = 'allowUnencrypted'
>> }
PS /home/dario> $vnet | Set-AzVirtualNetwork
ResourceGroupName Name Location ProvisioningState EnableDdosProtection
----------------- ---- -------- ----------------- --------------------
test-rg vnet-1 eastus2 Succeeded False

PS /home/dario> ## Place the virtual network configuration into a variable. ##


PS /home/dario> $net = @{
>> Name = 'vnet-1'
>> ResourceGroupName = 'test-rg'
>> }
PS /home/dario> $vnet = Get-AzVirtualNetwork @net
PS /home/dario> $vnet.Encryption

Enabled Enforcement
------- -----------
True AllowUnencrypted

PS /home/dario> $cleanup = @{
>> Name = "test-rg"
>> }
PS /home/dario> Remove-AzResourceGroup @cleanup -Force

You might also like