|
| 1 | +--- |
| 2 | +reviewed: 2026-04-04 |
| 3 | +severity: Important |
| 4 | +pillar: Security |
| 5 | +category: SE:08 Hardening resources |
| 6 | +resource: Azure Fleet |
| 7 | +resourceType: Microsoft.AzureFleet/fleets |
| 8 | +online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Fleet.PublicKey/ |
| 9 | +--- |
| 10 | + |
| 11 | +# Azure Fleet password-based authentication is enabled |
| 12 | + |
| 13 | +## SYNOPSIS |
| 14 | + |
| 15 | +Use SSH keys instead of common credentials to secure Linux Azure Fleet VMs against malicious activities. |
| 16 | + |
| 17 | +## DESCRIPTION |
| 18 | + |
| 19 | +Linux Azure Fleet virtual machine profiles should have password authentication disabled to help with eliminating password-based attacks. |
| 20 | + |
| 21 | +## RECOMMENDATION |
| 22 | + |
| 23 | +Consider disabling password-based authentication on Linux Azure Fleet VM profiles and instead use public keys. |
| 24 | + |
| 25 | +## EXAMPLES |
| 26 | + |
| 27 | +### Configure with Bicep |
| 28 | + |
| 29 | +To deploy an Azure Fleet that passes this rule: |
| 30 | + |
| 31 | +- Set the `properties.computeProfile.baseVirtualMachineProfile.osProfile.linuxConfiguration.disablePasswordAuthentication` property to `true`. |
| 32 | + |
| 33 | +For example: |
| 34 | + |
| 35 | +```bicep |
| 36 | +resource linux_fleet 'Microsoft.AzureFleet/fleets@2024-11-01' = { |
| 37 | + name: name |
| 38 | + location: location |
| 39 | + properties: { |
| 40 | + computeProfile: { |
| 41 | + baseVirtualMachineProfile: { |
| 42 | + osProfile: { |
| 43 | + computerNamePrefix: 'fleet' |
| 44 | + adminUsername: adminUsername |
| 45 | + linuxConfiguration: { |
| 46 | + disablePasswordAuthentication: true |
| 47 | + provisionVMAgent: true |
| 48 | + ssh: { |
| 49 | + publicKeys: [ |
| 50 | + { |
| 51 | + path: '/home/azureuser/.ssh/authorized_keys' |
| 52 | + keyData: sshPublicKey |
| 53 | + } |
| 54 | + ] |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + storageProfile: { |
| 59 | + imageReference: { |
| 60 | + publisher: 'MicrosoftCblMariner' |
| 61 | + offer: 'azure-linux-3' |
| 62 | + sku: 'azure-linux-3-gen2' |
| 63 | + version: 'latest' |
| 64 | + } |
| 65 | + osDisk: { |
| 66 | + createOption: 'FromImage' |
| 67 | + caching: 'ReadWrite' |
| 68 | + managedDisk: { |
| 69 | + storageAccountType: 'Premium_LRS' |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | + networkProfile: { |
| 74 | + networkInterfaceConfigurations: [ |
| 75 | + { |
| 76 | + name: 'netconfig' |
| 77 | + properties: { |
| 78 | + ipConfigurations: [ |
| 79 | + { |
| 80 | + name: 'ipconfig' |
| 81 | + properties: { |
| 82 | + primary: true |
| 83 | + subnet: { |
| 84 | + id: subnetId |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + ] |
| 89 | + } |
| 90 | + } |
| 91 | + ] |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + vmSizesProfile: [ |
| 96 | + { |
| 97 | + name: 'Standard_D8ds_v6' |
| 98 | + rank: 0 |
| 99 | + } |
| 100 | + ] |
| 101 | + regularPriorityProfile: { |
| 102 | + minCapacity: 1 |
| 103 | + capacity: 5 |
| 104 | + allocationStrategy: 'Prioritized' |
| 105 | + } |
| 106 | + } |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +### Configure with Azure template |
| 111 | + |
| 112 | +To deploy an Azure Fleet that passes this rule: |
| 113 | + |
| 114 | +- Set the `properties.computeProfile.baseVirtualMachineProfile.osProfile.linuxConfiguration.disablePasswordAuthentication` property to `true`. |
| 115 | + |
| 116 | +For example: |
| 117 | + |
| 118 | +```json |
| 119 | +{ |
| 120 | + "type": "Microsoft.AzureFleet/fleets", |
| 121 | + "apiVersion": "2024-11-01", |
| 122 | + "name": "[parameters('name')]", |
| 123 | + "location": "[parameters('location')]", |
| 124 | + "properties": { |
| 125 | + "computeProfile": { |
| 126 | + "baseVirtualMachineProfile": { |
| 127 | + "osProfile": { |
| 128 | + "computerNamePrefix": "fleet", |
| 129 | + "adminUsername": "[parameters('adminUsername')]", |
| 130 | + "linuxConfiguration": { |
| 131 | + "disablePasswordAuthentication": true, |
| 132 | + "provisionVMAgent": true, |
| 133 | + "ssh": { |
| 134 | + "publicKeys": [ |
| 135 | + { |
| 136 | + "path": "/home/azureuser/.ssh/authorized_keys", |
| 137 | + "keyData": "[parameters('sshPublicKey')]" |
| 138 | + } |
| 139 | + ] |
| 140 | + } |
| 141 | + } |
| 142 | + }, |
| 143 | + "storageProfile": { |
| 144 | + "imageReference": { |
| 145 | + "publisher": "MicrosoftCblMariner", |
| 146 | + "offer": "Cbl-Mariner", |
| 147 | + "sku": "cbl-mariner-2-gen2", |
| 148 | + "version": "latest" |
| 149 | + }, |
| 150 | + "osDisk": { |
| 151 | + "createOption": "FromImage", |
| 152 | + "caching": "ReadWrite", |
| 153 | + "managedDisk": { |
| 154 | + "storageAccountType": "Premium_LRS" |
| 155 | + } |
| 156 | + } |
| 157 | + }, |
| 158 | + "networkProfile": { |
| 159 | + "networkInterfaceConfigurations": [ |
| 160 | + { |
| 161 | + "name": "netconfig", |
| 162 | + "properties": { |
| 163 | + "ipConfigurations": [ |
| 164 | + { |
| 165 | + "name": "ipconfig", |
| 166 | + "properties": { |
| 167 | + "primary": true, |
| 168 | + "subnet": { |
| 169 | + "id": "[parameters('subnetId')]" |
| 170 | + } |
| 171 | + } |
| 172 | + } |
| 173 | + ] |
| 174 | + } |
| 175 | + } |
| 176 | + ] |
| 177 | + } |
| 178 | + } |
| 179 | + }, |
| 180 | + "vmSizesProfile": [ |
| 181 | + { |
| 182 | + "name": "Standard_D8ds_v6", |
| 183 | + "rank": 0 |
| 184 | + } |
| 185 | + ], |
| 186 | + "regularPriorityProfile": { |
| 187 | + "minCapacity": 1, |
| 188 | + "capacity": 5, |
| 189 | + "allocationStrategy": "Prioritized" |
| 190 | + } |
| 191 | + } |
| 192 | +} |
| 193 | +``` |
| 194 | + |
| 195 | +## LINKS |
| 196 | + |
| 197 | +- [SE:08 Hardening resources](https://learn.microsoft.com/azure/well-architected/security/harden-resources) |
| 198 | +- [Security: Level 2](https://learn.microsoft.com/azure/well-architected/security/maturity-model?tabs=level2) |
| 199 | +- [Azure security baseline for Linux Virtual Machines](https://learn.microsoft.com/security/benchmark/azure/baselines/virtual-machines-linux-virtual-machines-security-baseline) |
| 200 | +- [Detailed steps: Create and manage SSH keys for authentication to a Linux VM in Azure](https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed) |
| 201 | +- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.azurefleet/fleets) |
0 commit comments