[Azure][C#] 刪除已產生的憑證

2020-09-24

之前寫過一篇文章,關於產生憑證 取得 AppService 中的 Application Settings 並且更改值,但是文中產生的憑證超級大,之後我又搞了一輪,於是可以產生有限制的憑證 產生有權限的憑證控制,透過 C# 控制 Azure 上面的服務,之後問題了了,如何註銷之前 的憑證,經過我們家 DevOps 幫忙測試後..




假設之前產出來的憑證是

{ "clientId": "b52dd125-9272-4b21-9862-0be667bdf6dc", "clientSecret": "ebc6e170-72b2-4b6f-9de2-99410964d2d0", "subscriptionId": "ffa52f27-be12-4cad-b1ea-c2c241b6cceb", "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "activeDirectoryEndpointUrl": "https://login.microsoftonline.com", "resourceManagerEndpointUrl": "https://management.azure.com/", "activeDirectoryGraphResourceId": "https://graph.windows.net/", "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", "galleryEndpointUrl": "https://gallery.azure.com/", "managementEndpointUrl": "https://management.core.windows.net/" }


這時候雖然官方文件是寫 Identifier uri, application id, or object id of the associated application. 但是其實就是憑證中的 clientId

所以按照上面的憑證之後就是下指令..

az ad sp delete --id b52dd125-9272-4b21-9862-0be667bdf6dc






這邊我跟我們家 DevOps 測過了,之後憑證真的就失效不能用了,這邊筆記一下,免得以後忘記

reference :
https://docs.microsoft.com/en-us/cli/azure/ad/sp?view=azure-cli-latest#az_ad_sp_delete


當麻許的碎念筆記 2014 | Donma Hsu Design.