Skip to main content

ssh_public_keys

Creates, updates, deletes, gets or lists a ssh_public_keys resource.

Overview

Namessh_public_keys
TypeResource
Idazure.compute.ssh_public_keys

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
locationstringThe geo-location where the resource lives. Required.
publicKeystringSSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the publicKey property will be populated when generateKeyPair is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, ssh_public_key_name, subscription_idRetrieves information about an SSH public key.
list_by_resource_groupselectresource_group_name, subscription_idLists all of the SSH public keys in the specified resource group. Use the nextLink property in the response to get the next page of SSH public keys.
list_by_subscriptionselectsubscription_idLists 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.
createinsertresource_group_name, ssh_public_key_name, subscription_id, locationCreates a new SSH public key resource.
updateupdateresource_group_name, ssh_public_key_name, subscription_idUpdates a new SSH public key resource.
deletedeleteresource_group_name, ssh_public_key_name, subscription_idDelete an SSH public key.
generate_key_pairexecresource_group_name, ssh_public_key_name, subscription_idGenerates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
ssh_public_key_namestringThe name of the SSH public key. Required.
subscription_idstring

SELECT examples

Retrieves information about an SSH public key.

SELECT
id,
name,
location,
publicKey,
systemData,
tags,
type
FROM azure.compute.ssh_public_keys
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND ssh_public_key_name = '{{ ssh_public_key_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates a new SSH public key resource.

INSERT INTO azure.compute.ssh_public_keys (
tags,
location,
properties,
resource_group_name,
ssh_public_key_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ resource_group_name }}',
'{{ ssh_public_key_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type
;

UPDATE examples

Updates a new SSH public key resource.

UPDATE azure.compute.ssh_public_keys
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND ssh_public_key_name = '{{ ssh_public_key_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
properties,
systemData,
tags,
type;

DELETE examples

Delete an SSH public key.

DELETE FROM azure.compute.ssh_public_keys
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND ssh_public_key_name = '{{ ssh_public_key_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This operation can only be performed once per SSH public key resource.

EXEC azure.compute.ssh_public_keys.generate_key_pair 
@resource_group_name='{{ resource_group_name }}' --required,
@ssh_public_key_name='{{ ssh_public_key_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"encryptionType": "{{ encryptionType }}"
}'
;