Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Armory issues with snippets #1721

Merged
merged 11 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azure-pipelines/common/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ steps:
# Install nuget for use by 'npm run package'
- task: NuGetToolInstaller@0
inputs:
versionSpec: "5.2.0"
versionSpec: "5.11.6"

- task: NodeTool@0
displayName: "Install node.js"
inputs:
versionSpec: 18.16.0
versionSpec: 18.16.0

- script: npm install -g [email protected]
displayName: "Install npm"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"files.insertFinalNewline": true,
Expand Down
326 changes: 164 additions & 162 deletions assets/resourceSnippets/Ubuntu Virtual Machine.snippet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,167 +3,169 @@
"contentVersion": "1.0.0.0",
"metadata": {
"prefix": "arm-vm-ubuntu",
"description": "Ubuntu Virtual Machine"
"description": "Ubuntu Virtual Machine (see https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-secured-vm-from-template)"
},
"resources": [
{
"name": "[toLower('${1:ubuntuVM1}storage')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-01-01",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "${1:ubuntuVM1} Storage Account"
},
"sku": {
"name": /*${2:Standard_LRS}*/ "Standard_LRS"
},
"kind": /*${3|Storage,StorageV2|}*/ "Storage"
},
{
"name": "${1:ubuntuVM1}-PublicIP",
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2023-04-01",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "PublicIPAddress"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[toLower('${1:ubuntuVM1}')]"
}
}
},
{
"name": "${1:ubuntuVM1}-nsg",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2023-04-01",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "${4:nsgRule1}",
"properties": {
"description": "${5:description}",
"protocol": /*${6|Tcp,Udp,*|}*/ "Tcp",
"sourcePortRange": "${7:*}",
"destinationPortRange": "${8:22}",
"sourceAddressPrefix": "${9:*}",
"destinationAddressPrefix": "${10:*}",
"access": /*${11|Allow,Deny|}*/ "Allow",
"priority": /*${12:100}*/ 100,
"direction": /*${13|Inbound,Outbound|}*/ "Inbound"
}
}
]
}
},
{
"name": "${1:ubuntuVM1}-VirtualNetwork",
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2023-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', '${1:ubuntuVM1}-nsg')]"
],
"tags": {
"displayName": "${1:ubuntuVM1}-VirtualNetwork"
},
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"subnets": [
{
"name": "${1:ubuntuVM1}-VirtualNetwork-Subnet",
"properties": {
"addressPrefix": "10.0.0.0/24",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', '${1:ubuntuVM1}-nsg')]"
}
}
}
]
}
},
{
"name": "${1:ubuntuVM1}-NetworkInterface",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2023-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', '${1:ubuntuVM1}-PublicIP')]",
"[resourceId('Microsoft.Network/virtualNetworks', '${1:ubuntuVM1}-VirtualNetwork')]"
],
"tags": {
"displayName": "${1:ubuntuVM1}-NetworkInterface"
},
"properties": {
"ipConfigurations": [
{
"name": "ipConfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', '${1:ubuntuVM1}-PublicIP')]"
},
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', '${1:ubuntuVM1}-VirtualNetwork', '${1:ubuntuVM1}-VirtualNetwork-Subnet')]"
}
}
}
]
}
},
{
"name": "${1:ubuntuVM1}",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2023-03-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces', '${1:ubuntuVM1}-NetworkInterface')]"
],
"tags": {
"displayName": "${1:ubuntuVM1}"
},
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A2_v2"
},
"osProfile": {
"computerName": "${1:ubuntuVM1}",
"adminUsername": "${14:adminUsername}",
"adminPassword": "${15:adminPassword}"
},
"storageProfile": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "16.04-LTS",
"version": "latest"
},
"osDisk": {
"name": "${1:ubuntuVM1}-OSDisk",
"caching": "ReadWrite",
"createOption": "FromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', '${1:ubuntuVM1}-NetworkInterface')]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(resourceId('Microsoft.Storage/storageAccounts/', toLower('${1:ubuntuVM1}storage'))).primaryEndpoints.blob]"
}
}
}
}
]
"resources": [
{
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2020-05-01",
"name": "[variables('networkSecurityGroupName')]",
"location": "[parameters('location')]",
"properties": {
"securityRules": [
{
"name": "ssh_rule",
"properties": {
"description": "Locks inbound down to ssh default port 22.",
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 123,
"direction": "Inbound"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2020-05-01",
"name": "[variables('publicIPAddressName')]",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "Dynamic"
},
"sku": {
"name": "Basic"
}
},
{
"comments": "Simple Network Security Group for subnet [variables('vNetSubnetName')]",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2020-05-01",
"name": "[variables('networkSecurityGroupName2')]",
"location": "[parameters('location')]",
"properties": {
"securityRules": [
{
"name": "default-allow-22",
"properties": {
"priority": 1000,
"access": "Allow",
"direction": "Inbound",
"destinationPortRange": "22",
"protocol": "Tcp",
"sourceAddressPrefix": "*",
"sourcePortRange": "*",
"destinationAddressPrefix": "*"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-05-01",
"name": "[variables('vNetName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName2'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('vNetAddressPrefixes')]"
]
},
"subnets": [
{
"name": "[variables('vNetSubnetName')]",
"properties": {
"addressPrefix": "[variables('vNetSubnetAddressPrefix')]",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName2'))]"
}
}
}
]
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-05-01",
"name": "[variables('networkInterfaceName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', variables('vNetName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('vNetName'), variables('vNetSubnetName'))]"
}
}
}
]
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2021-11-01",
"name": "[variables('vmName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"storageProfile": {
"imageReference": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts-gen2",
"version": "latest"
},
"osDisk": {
"createOption": "fromImage"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
}
]
}
}
}
]
}
13 changes: 11 additions & 2 deletions assets/resourceSnippets/Virtual Network.snippet.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"tags": {
"displayName": "${1:virtualNetwork1}"
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
Expand All @@ -24,13 +27,19 @@
{
"name": "Subnet-1",
"properties": {
"addressPrefix": "10.0.0.0/24"
"addressPrefix": "10.0.0.0/24",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
}
}
},
{
"name": "Subnet-2",
"properties": {
"addressPrefix": "10.0.1.0/24"
"addressPrefix": "10.0.1.0/24",
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
}
}
}
]
Expand Down
Loading