I am trying to disable Public Network Access of Azure Data Factory through az powershell. As per Microsoft 
Could anyone please guide me?
My end goal is to achieve below configuration in Azure Data Factory (Connect via Private Endpoint):

CodePudding user response:
You need to pass DataFactoryName,ResourceGroupName,location to the Set-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.
Set-AzDataFactoryV2 -ResourceGroupName '<resourcegroupName>' -Name '<dataFactoryName>' -Location '<locationOfDataFactory>' -PublicNetworkAccess disabled
Here is the Sample Output screenshot for reference:
CodePudding user response:
Import-Module Az.DataFactory
Set-AzDataFactoryV2 -PublicNetworkAccess 'Disabled' -Force
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 and Az.Accounts module version is 2.8.0 and Az.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
Get-InstalledModule -Name Az
Try to upgrade the Az module, Az.Accounts and Az.Resources modules in the portal and check the versions again and try the PublicNetworkAccess after that. It may work.
Please refer Microsoft Documentation to upgrade the Az modules.



