如何从swa-cli注销Azure



Azure SWA提供swa login命令。如果我想注销Azure帐户怎么办。我能做什么?默认情况下没有swa logout命令。

因为我使用的是Windows 10。以下是清除凭据所需的命令。

查找swa-cli创建的所有凭证

cmdkey.exe /list | findstr swa-cli

清除swa-cli创建的所有凭证

cmdkey.exe /list | findstr swa-cli | ForEach-Object {
cmdkey /delete:$($_.Split(' ')[5])
}

从v11.4开始,有一个--clear-credentials命令行选项:

$ npx @azure/static-web-apps-cli login --help
Welcome to Azure Static Web Apps CLI (1.1.4)
Usage: swa login [options]
login into Azure
Options:
-S, --subscription-id <subscriptionId>  Azure subscription ID used by this project (default: "...")
-R, --resource-group <resourceGroup>    Azure resource group used by this project
-T, --tenant-id <tenantId>              Azure tenant ID (default: "...")
-C, --client-id <clientId>              Azure client ID
-CS, --client-secret <clientSecret>     Azure client secret
-n, --app-name <appName>                Azure Static Web App application name
👇
-CC, --clear-credentials                clear persisted credentials before login (default: false)

所以你可以运行:

npx @azure/static-web-apps-cli login --clear-credentials

或:

npx @azure/static-web-apps-cli login -CC

最新更新