列出指定容器登錄的登入認證。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listCredentials?api-version=2023-01-01-preview
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
registryName
|
path |
True
|
string
|
容器登錄的名稱。
Regex 模式: ^[a-zA-Z0-9]*$
|
resourceGroupName
|
path |
True
|
string
|
資源群組的名稱。 名稱不區分大小寫。
|
subscriptionId
|
path |
True
|
string
uuid
|
目標訂用帳戶的標識碼。 此值必須是 UUID。
|
api-version
|
query |
True
|
string
|
用於此作業的 API 版本。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
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
密碼名稱。
名稱 |
類型 |
Description |
password
|
string
|
|
password2
|
string
|
|
RegistryListCredentialsResult
ListCredentials 作業的回應。
名稱 |
類型 |
Description |
passwords
|
RegistryPassword[]
|
容器登錄的密碼清單。
|
username
|
string
|
容器登錄的用戶名稱。
|
RegistryPassword
容器登錄的登入密碼。