列出指定容器注册表的登录凭据。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials?api-version=2023-01-01-preview
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
registryName
|
path |
True
|
string
|
容器注册表的名称。
Regex pattern: ^[a-zA-Z0-9]*$
|
resourceGroupName
|
path |
True
|
string
|
资源组的名称。 此名称不区分大小写。
|
subscriptionId
|
path |
True
|
string
uuid
|
目标订阅的 ID。 该值必须是 UUID。
|
api-version
|
query |
True
|
string
|
要用于此操作的 API 版本。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 流
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
RegistryListCredentials
Sample Request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/listCredentials?api-version=2023-01-01-preview
package armcontainerregistry_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryListCredentials.json
func ExampleRegistriesClient_ListCredentials() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcontainerregistry.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewRegistriesClient().ListCredentials(ctx, "myResourceGroup", "myRegistry", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.RegistryListCredentialsResult = armcontainerregistry.RegistryListCredentialsResult{
// Passwords: []*armcontainerregistry.RegistryPassword{
// {
// Name: to.Ptr(armcontainerregistry.PasswordNamePassword),
// Value: to.Ptr("00000000000000000000000000000000"),
// },
// {
// Name: to.Ptr(armcontainerregistry.PasswordNamePassword2),
// Value: to.Ptr("00000000000000000000000000000000"),
// }},
// Username: to.Ptr("myRegistry"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerRegistryManagementClient } = require("@azure/arm-containerregistry");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the login credentials for the specified container registry.
*
* @summary Lists the login credentials for the specified container registry.
* x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2023-01-01-preview/examples/RegistryListCredentials.json
*/
async function registryListCredentials() {
const subscriptionId =
process.env["CONTAINERREGISTRY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["CONTAINERREGISTRY_RESOURCE_GROUP"] || "myResourceGroup";
const registryName = "myRegistry";
const credential = new DefaultAzureCredential();
const client = new ContainerRegistryManagementClient(credential, subscriptionId);
const result = await client.registries.listCredentials(resourceGroupName, registryName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"username": "myRegistry",
"passwords": [
{
"name": "password",
"value": "00000000000000000000000000000000"
},
{
"name": "password2",
"value": "00000000000000000000000000000000"
}
]
}
定义
PasswordName
密码名称。
名称 |
类型 |
说明 |
password
|
string
|
|
password2
|
string
|
|
RegistryListCredentialsResult
ListCredentials 操作的响应。
RegistryPassword
容器注册表的登录密码。