key vault -Disable Public Access under Firewall and Virtual Networks using powershell

Singh, Gaurav 5 Reputation points
2023-04-02T16:28:49.3733333+00:00

How can we Disable Public Access under Firewall and Virtual Networks using PowerShell script.

Thanks
Gaurav Singh

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,194 questions
{count} votes

2 answers

Sort by: Most helpful
  1. risolis 8,711 Reputation points
    2023-04-02T17:41:00.5166667+00:00

    Hello @Singh, Gaurav

    Thank you for posting this concern on this community space.

    I have read your whole case scenario description and I just wanted to double confirm your post request below:

    Are you referring to the following setting? *(I know you are requesting the same stuff but via PowerShell) *

    User's image

    I hope that will work for you.

    Looking forward to your feedback,

    Cheers,

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


  2. JamesTran-MSFT 36,541 Reputation points Microsoft Employee
    2023-04-04T18:11:09.5766667+00:00

    @Singh, Gaurav

    Thank you for your post and I apologize for the delayed response!

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to accept the answer.

    Issue:

    You're trying to Configure Azure Key Vault firewalls and virtual networks and would like a PowerShell script to disable public access to your Vault.

    Solution:

    You were able to use the following PowerShell script to disable public access to your Key Vault and resolve your issue.

    Azure PowerShell
    Update-AzKeyVault -VaultName "kvName" -ResourceGroupName "rgName" -PublicNetworkAccess "Disabled"  
    
    Az CLI 
    az keyvault update --name kvName --resource-group rgName --public-network-access Disabled
    

    Additional Links:

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

    I hope this helps!


    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.