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):
2
Answers
You need to pass
DataFactoryName,ResourceGroupName,location
to theSet-AzDatatFactoryV2
cmdlet in order to disable the public Network Access on the Data Factory.We have tested the below PowerShell cmdlet, and we are able to disable the public Network Access on Data Factory.
Here is the Sample Output screenshot for reference:
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
PublicNetworkAccess
is Disabled above and below in the Data factory as well.My
Az
module version is 8.0.0 andAz.Accounts
module version is 2.8.0 andAz.Resources
version 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
Az
module,Az.Accounts
andAz.Resources
modules in the portal and check the versions again and try thePublicNetworkAccess
after that. It may work.Please refer Microsoft Documentation to upgrade the Az modules.