I'm trying to remove a specific URL from Azure App Registrations. I tried the below command.
az ad app update --id <app-id> --remove web-redirect-uris 0
I used '0' (Index) as it doesn't allow us to delete the URL value. But it gives below error.
Couldn't find 'web' in 'web.redirect'. Available options: []
UPDATED
az rest \
--method PATCH \
--uri "https://graph.microsoft.com/v1.0/applications/<object-id>" \
--headers 'Content-Type=application/json' \
--body “{web:{redirectUris: https://URL1}}”
unrecognized arguments: https://URL1}}”
New
az rest \
--method "delete" \
--uri "https://graph.microsoft.com/v1.0/applications/<object-id>" \
--headers "{'Content-Type': 'application/json'}" \
--body "{'web': 'redirectUris': [ 'https://URL1' ] }"
As per august 2022, it is not supported anymore (due to MS Graph Migration).
From the documentation:
Generic update arguments
--add
,--set
and--remove
currently don't work. You may useaz rest
to directly call Microsoft Graph API for non-supported properties.
You can track the github issue here: Azure CLI cannot set values on nested properties.
so in your case something like that should work
az rest \
--method "patch" \
--uri "https://graph.microsoft.com/v1.0/applications/<object-id>" \
--headers "{'Content-Type': 'application/json'}" \
--body "{'web': 'redirectUris': [ 'https://URL1' ] }"