Anirudh Bragadeesan
Anirudh Bragadeesan

Reputation: 17

Power shell command to disable the networking setting of Azure Data Factory

In Azure Data Factory under the Settings options of "Networking", we have to disable the "Public Network Access", under the "Network access" option. If the public network access is "Enabled" then it is Open to Internet, which states that - "All Networks, including Internet can access Data Factory". And this is more threat of exposing the Data Factory to internet. For which we need a power-shell/AZ CLI command which will help us to disable the 'Public Network Access".

enter image description here

Upvotes: 1

Views: 1372

Answers (1)

Leon Yue
Leon Yue

Reputation: 16401

You could set it with properties.publicNetworkAccess, please see the code bellow:

Connect-AzAccount

$a= Get-AzResource -ResourceType Microsoft.DataFactory/factories -ResourceGroupName ChinaCXPTeam-Resources -ResourceName dfleon
$a.Properties.publicNetworkAccess = "Disabled"
$a | Set-AzResource -Force

Here are the module versions I use:

enter image description here

Update:

This command also works well:

$a = Get-AzResource -ResourceType Microsoft.DataFactory/factories -ResourceGroupName "<resource-group-name>" -ResourceName "<datafactory-name>"
$a.Properties | Add-Member -MemberType NoteProperty -Name "publicNetworkAccess" -Value "Disabled" -Force
$a | Set-AzResource -Force

Upvotes: 1

Related Questions