skip to Main Content

I’m working on setting up an application getaway with a group of backend app services. I am in the final configuration steps of configuring a listener, but first I need to set Application Gateway to support key vault reference certificates. I follow this guide from the official Microsoft documentation: Key Vault Azure Role-Based Access Control Permissions Model

via azure powershell, but i get this series of errors. In the case of getAzApplicationGateway, I have already verified that the name in which my resource is located is correct. As for get-AzApplicationGateweyIdentity and Add-Az-ApplicationGatewaySslCertifacate, I get: Cannot bind argument to parameter ‘ApplicationGateway’ because it is null. I can’t find the cause for this error, am I entering the wrong argument?

enter image description here

2

Answers


  1. Your first command in the posted snippet "Get-AzApplicationGateway" doesn’t find your gateway.
    At least in the snipped provided you don’t give -name and -ResourceGroupName as strings, meaning in " ".
    Wenn I run your commands with strings where they are required it works just fine

    Login or Signup to reply.
  2. When I ran the below command directly, I got the same error.

    $appgw = Get-AzApplicationGateway -Name YourApplicationGatewayName -ResourceGroupName YourRGName
    

    enter image description here

    • First, we need to create an Application Gateway.
      enter image description here

    • Create a Managed Identity.

    • After creating the ApplicationGateway and ManagedIdentity, now run the below commands.

     $appgw = Get-AzApplicationGateway -Name YourApplicationGatewayName -ResourceGroupName YourRGName
     Set-AzApplicationGatewayIdentity -ApplicationGateway $appgw -UserAssignedIdentityId "/subscriptions/YourSubscriptionID/resourceGroups/YourRGName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MyYourManagedIdentityName"
    

    enter image description here

    • Create a KeyVault and certificate by following the steps from the document and run the below command to
    $secret = Get-AzKeyVaultSecret -VaultName "YourKeyVaultName" -Name "YourCertificateName"
    
    Add-AzApplicationGatewaySslCertificate -KeyVaultSecretId $secretId -ApplicationGateway $appgw -Name $secret.Name
    
    • Before running the below command make sure you have created the Access policy with Get selected on Secret permissions and provided the created Managed Identity.
    Set-AzApplicationGateway -ApplicationGateway $appgw
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search