列出指定容器注册表的登录凭据。
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
minLength: 5 maxLength: 50 pattern: ^[a-zA-Z0-9]*$
|
容器注册表的名称。
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
资源组的名称。 名称不区分大小写。
|
subscriptionId
|
path |
True
|
string
(uuid)
|
目标订阅的 ID。 该值必须是 UUID。
|
api-version
|
query |
True
|
string
minLength: 1
|
用于此操作的 API 版本。
|
响应
安全性
azure_auth
Azure Active Directory OAuth2 Flow
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
RegistryListCredentials
示例请求
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
示例响应
{
"username": "myRegistry",
"passwords": [
{
"name": "password",
"value": "00000000000000000000000000000000"
},
{
"name": "password2",
"value": "00000000000000000000000000000000"
}
]
}
定义
PasswordName
枚举
密码名称。
RegistryListCredentialsResult
Object
ListCredentials作的响应。
RegistryPassword
Object
容器注册表的登录密码。