Add AAD authentication options to 'az network vnet-gateway'
Resource Provider Microsoft.Network
Description of Feature or Work Requested Need to add three string properties used to configure AAD authentication in VirtualNeworkGateway
Minimum API Version Required 2019-04-01
Swagger Link https://github.com/Azure/azure-rest-api-specs/pull/5935
Target Date No specific target, these are missing properties found by comparing Swagger and CLI
cc: @Nilambari
@number213 Thanks. I will put this one into our work list.
@number213 Hi, I have some questions for you to make this request more clear.
Do you want us to add three keyword arguments to only this commands az network vnet-gateway create ?
Also to az network vnet-gateway update
Working on it.
Could you provide some examples to demonstrate how to use these three arguments in requests?
Like create/update -aad-tenant-uri "https://login.microsoftonline.com/99163270-c9ab-4279-bb12-5353ed9bf6e1" -aad-audience-id "fd11706c-e78c-4828-8be7-ac7dcefd4b17" -aad-issuer-uri "https://sts.windows.net/99163270-c9ab-4279-bb12-5353ed9bf6e1/"
Also there should be a way to clear those three properties. I'm not sure which would be the best way to do that in CLI, maybe instead of adding new parameters to vnet-gateway it would be better to create subcategory vnet-gateway aad-authorization with create/update/delete.
If you have access to the repo for PowerShell cmdlet reviews, you can see discussion regarding behavior of this feature: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/309
For now, there is a subgroup called identity for ManagedIdentity which follows a pattern like this network application-gateway identity assign/remove/show. So I think maybe the style could be: az network vnet-gateway aad assign/remove/show. Seems like this style is more similar to yours.
What do you think? @number213 @MyronFanQiu
Looks good to me
I would also add those three parameters to az network vnet-gateway update/create for the convenience when user creates/updates under VPN Client Arguments section.

@number213 Why I got this error after I tried z network vnet-gateway aad assign -g "harold-rsg-01" --gateway-name "harold-vent-gw03" --aad-tenant "https://login.microsoftonline.com/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a" --aad-audience "0b1f6471-1bf0-4dda-aec3-cb9272f09590" --aad-issuer https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a
ERROR: Another operation on this or dependent resource is in progress. To retrieve status of the operation use uri: https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/41cdd5fd-cb64-42de-af5f-d92bf8fe2ac0?api-version=2019-09-01.
Anything I missing?
Please reach out to @Nilambari
Yes we want to add 3 AAD parameters to same command let. For removing AAD parameters from existing gateway, you can add one switch parameter:-RemoveAadAuthentication You can check how its done for PS commit:- https://github.com/Azure/azure-powershell/commit/45a074d6af298a5b580dc44db06a0cbf469a1478#diff-ee524d96b93a8e2193479dd5bce384d8 Test example :- https://raw.githubusercontent.com/Azure/azure-powershell/master/src/Network/Network.Test/ScenarioTests/VirtualNetworkGatewayTests.ps1 Function:-Test-VirtualNetworkGatewayOpenVPNAADAuth
Yes we want to add 3 AAD parameters to same command let. For removing AAD parameters from existing gateway, you can add one switch parameter:-RemoveAadAuthentication You can check how its done for PS commit:- Azure/azure-powershell@45a074d#diff-ee524d96b93a8e2193479dd5bce384d8 Test example :- https://raw.githubusercontent.com/Azure/azure-powershell/master/src/Network/Network.Test/ScenarioTests/VirtualNetworkGatewayTests.ps1 Function:-Test-VirtualNetworkGatewayOpenVPNAADAuth
I saw it. And one question, when creatiing with aad options. Why aad authentication info not set after creation, and succeded until Set-AzVirtualNetworkGateway -VirtualNetworkGateway $actual -AadTenant $aadTenant -AadIssuer $aadIssuer -AadAudience $aadAudienceNew run again?
Is it expected? If so, why bother adding those three parameters when creating?
Will this be fixed? If not, I will implement the first way.
There was a bug in service due to which creation of gateway with AAD params was not setting those values. But, that bug was fixed and it should work fine now.
No. it didn't.
Look at this changes https://github.com/Azure/azure-powershell/commit/45a074d6af298a5b580dc44db06a0cbf469a1478#diff-d59c42ac6511e0efb4112829fa209a1fR695,
specifically the function Test-VirtualNetworkGatewayOpenVPNAADAuth
I follow these steps on PowerShell and can not set AAD in the mean time I was creating a VirtualNetworkGateway:
New-AzVirtualNetworkGateway : Long running operation failed with status 'Failed'. Additional Info:'VPN AAD authentication configuration is not supported for the gateway.'
You can try to test whehter I am wrong or not. Keep me posted. Which is important, influencing the implementation.
Actually, previously we were not allowing to create gateway with AAD options. Later we removed that validation and that code is getting rolled out to production right now, will be done within a week. After that, creation of gateway with AAD params will work fine. So, we need AAD options added to create cmd let. Thanks!
Done.
You can use az network vnet-gateway aad -h for you convenience to assign/remove/show AAD info of a gateway.
Maybe we can add it to create command of vnet-gateway once the bug is fixed.
Feel free to reopen if any futher question.