1

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

3
  • Not sure if this is possible to do via PowerShell. Do you know you can use Integration runtimes and set the access policy to it, leaving your Public availability? Commented Sep 21, 2020 at 14:15
  • Why does it need to be powershell? Are you automatically deploying your ADF using Powershell? Have you already set up VNets and Private Endpoint for your data factory? Commented Sep 22, 2020 at 2:05
  • Hi @Anirudh Bragadeesan, we could use powersell command to get the data factory object, then set the property publicNetworkAccess to achieve that. Please see my answer. It works well. Commented Sep 22, 2020 at 7:51

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

12 Comments

In the $a object properties.publicNetworkAccess is not available. Because of that we are getting the below error.
In the $a.properties we are not able to find 'publicNetworkAccess' property. Because of that we are not able to set the value to it.
Error message- $a.Properties.publicNetworkAccess = "Disabled" SetValueInvocationException: Exception setting "publicNetworkAccess": "The property 'publicNetworkAccess' cannot be found on this object. Verify that the property exists and can be set."
@AnirudhBragadeesan which module version are you using?
@Leon Yue we have urgent requirement if you can help quick that will be great. Kindly let us know exactly how we can extract the property of 'publicNetworkAccess' from the $a object.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.