Listas todas las claves públicas SSH de la suscripción. Use la propiedad nextLink en la respuesta para obtener la página siguiente de claves públicas SSH.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys?api-version=2024-03-01
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
subscriptionId
|
path |
True
|
string
|
Credenciales de suscripción que identifican de forma única la suscripción de Microsoft Azure. El identificador de suscripción forma parte del URI para cada llamada al servicio.
|
api-version
|
query |
True
|
string
|
Versión de api de cliente.
|
Respuestas
Seguridad
azure_auth
Flujo OAuth2 de Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nombre |
Description |
user_impersonation
|
suplantación de su cuenta de usuario
|
Ejemplos
SshPublicKey_ListBySubscription_MaximumSet_Gen
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/sshPublicKeys?api-version=2024-03-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python ssh_public_key_list_by_subscription_maximum_set_gen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.ssh_public_keys.list_by_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json
func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeyListBySubscriptionMaximumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{
// Value: []*armcompute.SSHPublicKeyResource{
// {
// Name: to.Ptr("mySshPublicKeyName"),
// Type: to.Ptr("aaaa"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "key6396": to.Ptr("aaaaaaaaaaaaa"),
// "key8839": to.Ptr("aaa"),
// },
// Properties: &armcompute.SSHPublicKeyResourceProperties{
// PublicKey: to.Ptr("{ssh-rsa public key}"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys.
*
* @summary Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json
*/
async function sshPublicKeyListBySubscriptionMaximumSetGen() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.sshPublicKeys.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
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
{
"value": [
{
"location": "westus",
"properties": {
"publicKey": "{ssh-rsa public key}"
},
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName",
"name": "mySshPublicKeyName",
"type": "aaaa",
"tags": {
"key6396": "aaaaaaaaaaaaa",
"key8839": "aaa"
}
}
],
"nextLink": "aaaa"
}
SshPublicKey_ListBySubscription_MinimumSet_Gen
Sample Request
GET https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/sshPublicKeys?api-version=2024-03-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-compute
# USAGE
python ssh_public_key_list_by_subscription_minimum_set_gen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ComputeManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.ssh_public_keys.list_by_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcompute_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/92de53a5f1e0e03c94b40475d2135d97148ed014/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json
func ExampleSSHPublicKeysClient_NewListBySubscriptionPager_sshPublicKeyListBySubscriptionMinimumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcompute.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewSSHPublicKeysClient().NewListBySubscriptionPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.SSHPublicKeysGroupListResult = armcompute.SSHPublicKeysGroupListResult{
// Value: []*armcompute.SSHPublicKeyResource{
// {
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"),
// Location: to.Ptr("westus"),
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ComputeManagementClient } = require("@azure/arm-compute");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys.
*
* @summary Lists all of the SSH public keys in the subscription. Use the nextLink property in the response to get the next page of SSH public keys.
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2024-03-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json
*/
async function sshPublicKeyListBySubscriptionMinimumSetGen() {
const subscriptionId = process.env["COMPUTE_SUBSCRIPTION_ID"] || "{subscription-id}";
const credential = new DefaultAzureCredential();
const client = new ComputeManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.sshPublicKeys.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
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
{
"value": [
{
"location": "westus",
"id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/sshPublicKeys/mySshPublicKeyName"
}
]
}
Definiciones
ApiError
Error de api.
Nombre |
Tipo |
Description |
code
|
string
|
Código de error.
|
details
|
ApiErrorBase[]
|
Detalles del error de api
|
innererror
|
InnerError
|
Error interno de api
|
message
|
string
|
El mensaje de error.
|
target
|
string
|
Destino del error determinado.
|
ApiErrorBase
Base de errores de api.
Nombre |
Tipo |
Description |
code
|
string
|
Código de error.
|
message
|
string
|
El mensaje de error.
|
target
|
string
|
Destino del error determinado.
|
CloudError
Respuesta de error del servicio Compute.
Nombre |
Tipo |
Description |
error
|
ApiError
|
Error de api.
|
InnerError
Detalles del error interno.
Nombre |
Tipo |
Description |
errordetail
|
string
|
Mensaje de error interno o volcado de memoria de excepciones.
|
exceptiontype
|
string
|
Tipo de la excepción.
|
SshPublicKeyResource
Especifica información sobre la clave pública SSH.
Nombre |
Tipo |
Description |
id
|
string
|
Id. de recurso
|
location
|
string
|
Ubicación de los recursos
|
name
|
string
|
Nombre del recurso
|
properties.publicKey
|
string
|
Clave pública SSH usada para autenticarse en una máquina virtual mediante ssh. Si esta propiedad no se proporciona inicialmente cuando se crea el recurso, la propiedad publicKey se rellenará cuando se llame a generateKeyPair. Si se proporciona la clave pública tras la creación de recursos, la clave pública proporcionada debe tener al menos 2048 bits y en formato ssh-rsa.
|
tags
|
object
|
Etiquetas del recurso
|
type
|
string
|
Tipo de recurso
|
SshPublicKeysGroupListResult
Respuesta de la operación de la operación de claves públicas SSH de lista.
Nombre |
Tipo |
Description |
nextLink
|
string
|
URI para capturar la página siguiente de claves públicas SSH. Llame a ListNext() con este URI para capturar la página siguiente de claves públicas SSH.
|
value
|
SshPublicKeyResource[]
|
Lista de claves públicas SSH
|