Share via


Microsoft.Compute sshPublicKeys 2024-07-01

Bicep resource definition

The sshPublicKeys resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/sshPublicKeys resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.Compute/sshPublicKeys@2024-07-01' = {
  scope: resourceSymbolicName or scope
  ___location: 'string'
  name: 'string'
  properties: {
    publicKey: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
}

Property Values

Microsoft.Compute/sshPublicKeys

Name Description Value
___location Resource ___location string (required)
name The resource name string (required)
properties Properties of the SSH public key. SshPublicKeyResourceProperties
scope Use when creating a resource at a scope that is different than the deployment scope. Set this property to the symbolic name of a resource to apply the extension resource.
tags Resource tags Dictionary of tag names and values. See Tags in templates

ResourceTags

Name Description Value

SshPublicKeyResourceProperties

Name Description Value
publicKey SSH 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. string

Usage Examples

Azure Verified Modules

The following Azure Verified Modules can be used to deploy this resource type.

Module Description
Public SSH Key AVM Resource Module for Public SSH Key

ARM template resource definition

The sshPublicKeys resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/sshPublicKeys resource, add the following JSON to your template.

{
  "type": "Microsoft.Compute/sshPublicKeys",
  "apiVersion": "2024-07-01",
  "name": "string",
  "___location": "string",
  "properties": {
    "publicKey": "string"
  },
  "tags": {
    "{customized property}": "string"
  }
}

Property Values

Microsoft.Compute/sshPublicKeys

Name Description Value
apiVersion The api version '2024-07-01'
___location Resource ___location string (required)
name The resource name string (required)
properties Properties of the SSH public key. SshPublicKeyResourceProperties
tags Resource tags Dictionary of tag names and values. See Tags in templates
type The resource type 'Microsoft.Compute/sshPublicKeys'

ResourceTags

Name Description Value

SshPublicKeyResourceProperties

Name Description Value
publicKey SSH 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. string

Usage Examples

Terraform (AzAPI provider) resource definition

The sshPublicKeys resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/sshPublicKeys resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/sshPublicKeys@2024-07-01"
  name = "string"
  parent_id = "string"
  ___location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    properties = {
      publicKey = "string"
    }
  }
}

Property Values

Microsoft.Compute/sshPublicKeys

Name Description Value
___location Resource ___location string (required)
name The resource name string (required)
parent_id The ID of the resource to apply this extension resource to. string (required)
properties Properties of the SSH public key. SshPublicKeyResourceProperties
tags Resource tags Dictionary of tag names and values.
type The resource type "Microsoft.Compute/sshPublicKeys@2024-07-01"

ResourceTags

Name Description Value

SshPublicKeyResourceProperties

Name Description Value
publicKey SSH 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. string

Usage Examples

Terraform Samples

A basic example of deploying SSH Public Key.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "___location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  ___location = var.___location
}

resource "azapi_resource" "sshPublicKey" {
  type      = "Microsoft.Compute/sshPublicKeys@2021-11-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  ___location  = var.___location
  body = {
    properties = {
      publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"
    }
    tags = {
      test-tag = "test-value-230630032848837073"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

Azure Verified Modules

The following Azure Verified Modules can be used to deploy this resource type.

Module Description
Public SSH Key AVM Resource Module for Public SSH Key