Updating web redirect uri of Azure AD app registration

I have a scenario where my pipeline should update the app registration with an additional redirectUrl.
I have managed to extract the current web.redirectUris with the following:

existing_urls=$(az ad app show --id '<client-id>' --query "[web.redirectUris]" --output tsv)

I would like to achieve something like this

existing_urls=$(az ad app show --id '<client-id>' --query "[web.redirectUris]" --output tsv)
az ad app update --id '<client-id>' --web-redirect-uris "$existing_urls https://hostname.com/newCallback"

I have tried updating the web.redirectUris in two ways and both of them have failed when I pass multiple redirect URIs.

Attempt 1

az ad app update --id '<client-id>' --web-redirect-uris "https://hostname.com/callbackx https://hostname.com/callbacky"

One or more properties contains invalid values.

However when having only one uri this worked fine

az ad app update --id '<client-id>' --web-redirect-uris "https://hostname.com/callbackx"

Attempt 2
This one fails regardless of number of redirectUris that are passed

az ad app update --id '<client-id>' --set "web.redirectUris=['https://hostname.com/callbackx', 'https://hostname.com/callbacky']"

Couldn't find 'web' in ''. Available options: []

Tried as shown :But got the same error:

az ad app show --id 1e7bxxx7830

existing_urls=$(az ad app show --id 1e7b8fxxxx830 --query "[web.redirectUris]")

az ad app update --id 1e7xxx0a7830 --web-redirect-uris "$existing_urls https://hostname.com/newCallback"

$updated_urls="$existing_urls https://hostname.com/newCallback"

az ad app update --id 1e7b8xxx0a7830  --set "web.redirectUris='$updated_urls'"

az ad app update --id 1e7b8fxxxd0a7830  --set "web.redirectUris='$updated_urls'"

Error:

Couldn't find 'web' in ''. Available options: []

enter image description here

Following command worked foe me in azure cli in updating multiple Redirect Urls:

az ad app update --id '1e7bxxxa7830' --web-redirect-uris "https://hostname.com/callback" "https://jwt.ms" "https://myexampleapp.com"

here –id is clientId .

enter image description here

So give the command with required urls as
az ad app update –id ‘1e7bxxxa7830’ –web-redirect-uris “<url1>” “<url2>” “<url3>

upon az ad app show --id 1e7b8xxxx830

enter image description here

Recognized by Microsoft Azure Collective

I also wanted to automate this as part of the DevOps pipeline so got this working with the following bash script:

#!/bin/bash
new_uri="<your_new_redirect_uri>" # or take from parameter with $1
client_id="<your_client_id>"

# Get string array of existing redirect URIs
existing_redirect_uris=$(az ad app show --id $client_id --query "[web.redirectUris]" --output tsv)
echo $existing_redirect_uris

# Check if the new URI is already in the list
if [[ $existing_redirect_uris == *$new_uri* ]]; then
    echo "The URI $new_uri is already in the list"
else
    echo "Adding the URI $new_uri to the list"
    az ad app update --id $client_id --web-redirect-uris $existing_redirect_uris $new_uri
fi

And other script to remove redirect URI from the list:

#!/bin/bash
remove_uri="<remove_redirect_uri>" # or take from parameter with $1
client_id="<your_client_id>"

# Get list of existing redirect URIs and already remove selected with sed from that list
remaining_redirect_uris=$(az ad app show --id $client_id --query "[web.redirectUris]" --output tsv | sed "s|$remove_uri||g")
echo $remaining_redirect_uris
az ad app update --id $client_id --web-redirect-uris $remaining_redirect_uris

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật