I am trying to disable Public Network Access of Azure Data Factory through az powershell. As per Microsoft documentation, there is a property called PublicNetworkAccess. So I tried below commands,
Import-Module Az.DataFactory
Set-AzDataFactoryV2 -PublicNetworkAccess 'Disabled' -Force
Could anyone please guide me?
My end goal is to achieve below configuration in Azure Data Factory (Connect via Private Endpoint):



The above script which you mentioned is working fine. You just need to type the Resource group name, Data factory name and location after executing it like below.
You can see my
PublicNetworkAccessis Disabled above and below in the Data factory as well.My
Azmodule version is 8.0.0 andAz.Accountsmodule version is 2.8.0 andAz.Resourcesversion is 6.0.0.So, may be the issue arise due to the Az modules version.
Please check the version of the modules with the command below
Try to upgrade the
Azmodule,Az.AccountsandAz.Resourcesmodules in the portal and check the versions again and try thePublicNetworkAccessafter that. It may work.Please refer Microsoft Documentation to upgrade the Az modules.