Ad Existing virtual network and subnet to Keyvault using powershell

SethuRam 66 Reputation points
2021-09-17T19:10:40.403+00:00

Hello ,
I am able to successfull create a key vault using below azure cli command
az keyvault create --name $kvname --resource-group $rgname --location $location --enable-soft-delete true

I have a business case to add existing virtual network and subnet using private endpoint to out new key vault using CLI command . I didnt find any command that does this , could anyone please let me know if we can achieve this using powershell or azure cli?

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,128 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,382 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 45,096 Reputation points
    2021-09-17T20:01:25.59+00:00

    How about Add-AzKeyVaultNetworkRule or Update-AzKeyVaultNetworkRuleSet

    0 comments No comments

  2. Andreas Baumgarten 97,396 Reputation points MVP
    2021-09-17T20:20:51.357+00:00

    Hi @SethuRam ,

    if you are looking for the AZ CLI command please take a look here:
    https://learn.microsoft.com/en-us/cli/azure/keyvault/network-rule?view=azure-cli-latest

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    0 comments No comments

  3. Limitless Technology 39,376 Reputation points
    2021-09-20T11:51:26.857+00:00

    Hello Surya,

    In order to work on the AZ CLI command, do have a look at the below link, which will be helpful to you

    https://learn.microsoft.com/en-us/cli/azure/keyvault/network-rule?view=azure-cli-latest

    Do follow the below link for a better understanding,

    https://learn.microsoft.com/en-us/azure/key-vault/general/how-to-azure-key-vault-network-security?tabs=azure-powershell

    Hope this answers all your queries, if not please do repost back.
    If an Answer is helpful, please click "Accept Answer" and upvote it : )

    0 comments No comments