Reputation: 305
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):
Upvotes: 0
Views: 585
Reputation: 11304
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.
Upvotes: 1
Reputation: 5506
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:
Upvotes: 1