Azure CLI 示例:重置帐户凭据Azure CLI example: Reset the account credentials

媒体服务徽标 v3media services logo v3

本文中的 Azure CLI 脚本演示如何重置帐户凭据和恢复 app.config 设置。The Azure CLI script in this article shows how to reset your account credentials and get the app.config settings back.


创建媒体服务帐户Create a Media Services account.


可以在本地安装 CLI。You can install the CLI locally. 有关适用于你的平台的说明,请参阅安装 Azure CLISee Install the Azure CLI for instructions for your platform.

登录Sign in

使用本地安装的 CLI 需要登录到 Azure。Using a local install of the CLI requires signing in to Azure. 使用 az login 命令登录。Sign in with the az login command.

如果 CLI 可以打开默认的浏览器,则它会打开该浏览器并加载登录页。If the CLI can open your default browser, it will do so and load a sign-in page. 否则,你需要打开一个浏览器页面,在浏览器中导航到 后,按照有关命令行的说明输入授权代码。Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to in your browser.

指定文件位置Specify location of files

许多媒体服务 CLI 命令允许你通过文件名来传递参数。Many Media Services CLI commands allow you to pass a parameter with a file name.

需要根据所用的 OS 或 Shell(Bash 或 PowerShell)指定文件路径。You need to specify the file path according to the OS or Shell (Bash or PowerShell) that you are using. 下面是一些示例:Below are some examples:

文件(所有 OS)的相对路径Relative path to the file (all OS)

  • @"mytestfile.json"
  • @"../mytestfile.json"

Linux/Mac 和 Windows OS 上的绝对文件路径Absolute file path on Linux/Mac and Windows OS

  • @ "/usr/home/mytestfile.json"
  • @"c:\tmp\user\mytestfile.json"

如果命令要求提供文件路径,请使用 {file}Use {file} if the command is asking for a path to the file. 例如,az ams transform create -a amsaccount -g resourceGroup -n custom --preset .\customPreset.jsonFor example, az ams transform create -a amsaccount -g resourceGroup -n custom --preset .\customPreset.json.
如果命令将加载指定的文件,请使用 @{file}Use @{file} if the command is going to load the specified file. 例如,az ams account-filter create -a amsaccount -g resourceGroup -n filterName --tracks @tracks.jsonFor example, az ams account-filter create -a amsaccount -g resourceGroup -n filterName --tracks @tracks.json.

示例脚本Example script

# Update the following variables for your own settings:

az ams account sp reset-credentials \
  --account-name $amsAccountName \
  --resource-group $resourceGroup

后续步骤Next steps