diff --git a/src/Bicep.Core.Samples/Files/Completions/declarations.json b/src/Bicep.Core.Samples/Files/Completions/declarations.json index 6c6962fa8e1..229da775288 100644 --- a/src/Bicep.Core.Samples/Files/Completions/declarations.json +++ b/src/Bicep.Core.Samples/Files/Completions/declarations.json @@ -273,6 +273,151 @@ ] } }, + { + "label": "res-app-gateway", + "kind": "snippet", + "detail": "Application Gateway", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource applicationGateway 'Microsoft.Network/applicationGateways@2020-11-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n sku: {\n name: 'Standard_Small'\n tier: 'Standard'\n capacity: 'capacity'\n }\n gatewayIPConfigurations: [\n {\n name: 'name'\n properties: {\n subnet: {\n id: 'id'\n }\n }\n }\n ]\n frontendIPConfigurations: [\n {\n name: 'name'\n properties: {\n publicIPAddress: {\n id: 'id'\n }\n }\n }\n ]\n frontendPorts: [\n {\n name: 'name'\n properties: {\n port: 'port'\n }\n }\n ]\n backendAddressPools: [\n {\n name: 'name'\n }\n ]\n backendHttpSettingsCollection: [\n {\n name: 'name'\n properties: {\n port: 'port'\n protocol: 'Http'\n cookieBasedAffinity: 'Disabled'\n }\n }\n ]\n httpListeners: [\n {\n name: 'name'\n properties: {\n frontendIPConfiguration: {\n id: 'id'\n }\n frontendPort: {\n id: 'id'\n }\n protocol: 'Http'\n sslCertificate: null\n }\n }\n ]\n requestRoutingRules: [\n {\n name: 'name'\n properties: {\n ruleType: 'Basic'\n httpListener: {\n id: 'id'\n }\n backendAddressPool: {\n id: 'id'\n }\n backendHttpSettings: {\n id: 'id'\n }\n }\n }\n ]\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-app-gateway", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:applicationGateway} 'Microsoft.Network/applicationGateways@2020-11-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n sku: {\n name: '${3|Standard_Small,Standard_Medium,Standard_Large,WAF_Medium,WAF_Large,Standard_v2,WAF_v2|}'\n tier: '${4|Standard,WAF,Standard_v2,WAF_v2|}'\n capacity: ${5:'capacity'}\n }\n gatewayIPConfigurations: [\n {\n name: ${6:'name'}\n properties: {\n subnet: {\n id: ${7:'id'}\n }\n }\n }\n ]\n frontendIPConfigurations: [\n {\n name: ${8:'name'}\n properties: {\n publicIPAddress: {\n id: ${9:'id'}\n }\n }\n }\n ]\n frontendPorts: [\n {\n name: ${10:'name'}\n properties: {\n port: ${11:'port'}\n }\n }\n ]\n backendAddressPools: [\n {\n name: ${12:'name'}\n }\n ]\n backendHttpSettingsCollection: [\n {\n name: ${13:'name'}\n properties: {\n port: ${14:'port'}\n protocol: '${15|Http,Https|}'\n cookieBasedAffinity: 'Disabled'\n }\n }\n ]\n httpListeners: [\n {\n name: ${16:'name'}\n properties: {\n frontendIPConfiguration: {\n id: ${17:'id'}\n }\n frontendPort: {\n id: ${18:'id'}\n }\n protocol: '${19|Http,Https|}'\n sslCertificate: null\n }\n }\n ]\n requestRoutingRules: [\n {\n name: ${20:'name'}\n properties: {\n ruleType: '${21|Basic,PathBasedRouting|}'\n httpListener: {\n id: ${22:'id'}\n }\n backendAddressPool: {\n id: ${23:'id'}\n }\n backendHttpSettings: {\n id: ${24:'id'}\n }\n }\n }\n ]\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-app-gateway" + } + } + ] + } + }, + { + "label": "res-app-gateway-waf", + "kind": "snippet", + "detail": "Application Gateway with Web Application Firewall", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource applicationGatewayFirewall 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n policySettings: {\n requestBodyCheck: true\n maxRequestBodySizeInKb: 'maxRequestBodySizeInKb'\n fileUploadLimitInMb: 'fileUploadLimitInMb'\n state: 'Enabled'\n mode: 'Detection'\n }\n managedRules: {\n managedRuleSets: [\n {\n ruleSetType: 'ruleSetType'\n ruleSetVersion: 'ruleSetVersion'\n }\n ]\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-app-gateway-waf", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:applicationGatewayFirewall} 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n policySettings: {\n requestBodyCheck: ${3|true,false|}\n maxRequestBodySizeInKb: ${4:'maxRequestBodySizeInKb'}\n fileUploadLimitInMb: ${5:'fileUploadLimitInMb'}\n state: '${6|Enabled,Disabled|}'\n mode: '${7|Detection,Prevention|}'\n }\n managedRules: {\n managedRuleSets: [\n {\n ruleSetType: ${8:'ruleSetType'}\n ruleSetVersion: ${9:'ruleSetVersion'}\n }\n ]\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-app-gateway-waf" + } + } + ] + } + }, + { + "label": "res-app-insights", + "kind": "snippet", + "detail": "Application Insights for Web Apps", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource appInsightsComponents 'Microsoft.Insights/components@2020-02-02-preview' = {\n name: 'name'\n location: resourceGroup().location\n kind: 'web'\n properties: {\n Application_Type: 'web'\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-app-insights", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:appInsightsComponents} 'Microsoft.Insights/components@2020-02-02-preview' = {\n name: ${2:'name'}\n location: resourceGroup().location\n kind: 'web'\n properties: {\n Application_Type: '${3|web,other|}'\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-app-insights" + } + } + ] + } + }, + { + "label": "res-app-insights-alert-rules", + "kind": "snippet", + "detail": "Application Insights Alert Rules", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource appInsightsAlertRules 'Microsoft.Insights/alertrules@2016-03-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n name: 'name'\n description: 'description'\n isEnabled: false\n condition: {\n failedLocationCount: 'failedLocationCount'\n 'odata.type': 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition'\n dataSource: {\n 'odata.type': 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource'\n resourceUri: 'resourceUri'\n }\n windowSize: 'windowSize'\n }\n action: {\n 'odata.type': 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction'\n sendToServiceOwners: true\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-app-insights-alert-rules", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:appInsightsAlertRules} 'Microsoft.Insights/alertrules@2016-03-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n name: ${3:'name'}\n description: ${4:'description'}\n isEnabled: false\n condition: {\n failedLocationCount: ${5:'failedLocationCount'}\n 'odata.type': '${6|Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition,Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition,Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition|}'\n dataSource: {\n 'odata.type': '${7|Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource,Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource|}'\n resourceUri: ${8:'resourceUri'}\n }\n windowSize: ${9:'windowSize'}\n }\n action: {\n 'odata.type': '${10|Microsoft.Azure.Management.Insights.Models.RuleEmailAction,Microsoft.Azure.Management.Insights.Models.RuleWebhookAction|}'\n sendToServiceOwners: true\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-app-insights-alert-rules" + } + } + ] + } + }, + { + "label": "res-app-insights-auto-scale-settings", + "kind": "snippet", + "detail": "Application Insights Auto Scale Settings", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource appInsightsAutoScaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = {\n name: 'name'\n location: resourceGroup().location\n tags: {\n Application_Type: 'web'\n 'hidden-link:appServiceId': 'Resource'\n }\n properties: {\n name: 'name'\n profiles: [\n {\n name: 'name'\n capacity: {\n minimum: 'minimum'\n maximum: 'maximum'\n default: 'default'\n }\n rules: [\n {\n metricTrigger: {\n metricName: 'name'\n metricResourceUri: 'metricResourceUri'\n timeGrain: 'PT1M'\n statistic: 'Average'\n timeWindow: 'PT10M'\n timeAggregation: 'Average'\n operator: 'GreaterThan'\n threshold: 80\n }\n scaleAction: {\n direction: 'Increase'\n type: 'ChangeCount'\n value: 'value'\n cooldown: 'PT10M'\n }\n }\n {\n metricTrigger: {\n metricName: 'metricName'\n metricResourceUri: 'metricResourceUri'\n timeGrain: 'PT1M'\n statistic: 'Average'\n timeWindow: 'PT1H'\n timeAggregation: 'Average'\n operator: 'LessThan'\n threshold: 60\n }\n scaleAction: {\n direction: 'Decrease'\n type: 'ChangeCount'\n value: 'value'\n cooldown: 'PT1H'\n }\n }\n ]\n }\n ]\n enabled: false\n targetResourceUri: 'targetResourceUri'\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-app-insights-auto-scale-settings", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:appInsightsAutoScaleSettings} 'Microsoft.Insights/autoscalesettings@2015-04-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n tags: {\n Application_Type: '${3|web,other|}'\n 'hidden-link:${4:appServiceId}': 'Resource'\n }\n properties: {\n name: ${5:'name'}\n profiles: [\n {\n name: ${6:'name'}\n capacity: {\n minimum: ${7:'minimum'}\n maximum: ${8:'maximum'}\n default: ${9:'default'}\n }\n rules: [\n {\n metricTrigger: {\n metricName: ${10:'name'}\n metricResourceUri: ${11:'metricResourceUri'}\n timeGrain: 'PT1M'\n statistic: 'Average'\n timeWindow: 'PT10M'\n timeAggregation: 'Average'\n operator: 'GreaterThan'\n threshold: 80\n }\n scaleAction: {\n direction: 'Increase'\n type: 'ChangeCount'\n value: ${12:'value'}\n cooldown: 'PT10M'\n }\n }\n {\n metricTrigger: {\n metricName: ${13:'metricName'}\n metricResourceUri: ${14:'metricResourceUri'}\n timeGrain: 'PT1M'\n statistic: 'Average'\n timeWindow: 'PT1H'\n timeAggregation: 'Average'\n operator: 'LessThan'\n threshold: 60\n }\n scaleAction: {\n direction: 'Decrease'\n type: 'ChangeCount'\n value: ${15:'value'}\n cooldown: 'PT1H'\n }\n }\n ]\n }\n ]\n enabled: false\n targetResourceUri: ${16:'targetResourceUri'}\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-app-insights-auto-scale-settings" + } + } + ] + } + }, { "label": "res-app-plan", "kind": "snippet", @@ -940,6 +1085,35 @@ ] } }, + { + "label": "res-dns-record", + "kind": "snippet", + "detail": "DNS Record", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {\n name: 'name'\n location: resourceGroup().location\n}\n\nresource dnsRecord 'Microsoft.Network/dnsZones/A@2018-05-01' = {\n parent: dnsZone\n name: 'name'\n properties: {\n TTL: 3600\n 'ARecords': []\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-dns-record", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {\n name: ${1:'name'}\n location: resourceGroup().location\n}\n\nresource ${2:dnsRecord} 'Microsoft.Network/dnsZones/${3|A,AAAA,CNAME,MX,NS,PTR,SOA,SRV,TXT|}@2018-05-01' = {\n parent: dnsZone\n name: ${4:'name'}\n properties: {\n TTL: 3600\n '${5|ARecords,AAAARecords,MXRecords,NSRecords,PTRRecords,SRVRecords,TXTRecords,CNAMERecord,SOARecord|}': []\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-dns-record" + } + } + ] + } + }, { "label": "res-dns-zone", "kind": "snippet", @@ -969,6 +1143,35 @@ ] } }, + { + "label": "res-firewall", + "kind": "snippet", + "detail": "Azure Firewall", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource firewall 'Microsoft.Network/azureFirewalls@2020-11-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n applicationRuleCollections: [\n {\n name: 'name'\n properties: {\n priority: 'priority'\n action: {\n type: 'Allow'\n }\n rules: [\n {\n name: 'name'\n description: 'description'\n sourceAddresses: [\n 'sourceAddress'\n ]\n protocols: [\n {\n protocolType: 'Http'\n port: 80\n }\n ]\n targetFqdns: [\n 'www.microsoft.com'\n ]\n }\n ]\n }\n }\n ]\n natRuleCollections: [\n {\n name: 'name'\n properties: {\n priority: 'priority'\n action: {\n type: 'Dnat'\n }\n rules: [\n {\n name: 'name'\n description: 'description'\n sourceAddresses: [\n 'sourceAddress'\n ]\n destinationAddresses: [\n 'destinationAddress'\n ]\n destinationPorts: [\n 'port'\n ]\n protocols: [\n 'TCP'\n ]\n translatedAddress: 'translatedAddress'\n translatedPort: 'translatedPort'\n }\n ]\n }\n }\n ]\n networkRuleCollections: [\n {\n name: 'name'\n properties: {\n priority: 'priority'\n action: {\n type: 'Deny'\n }\n rules: [\n {\n name: 'name'\n description: 'description'\n sourceAddresses: [\n 'sourceAddress'\n ]\n destinationAddresses: [\n 'destinationAddress'\n ]\n destinationPorts: [\n 'destinationPort'\n ]\n protocols: [\n 'TCP'\n ]\n }\n ]\n }\n }\n ]\n ipConfigurations: [\n {\n name: 'name'\n properties: {\n subnet: {\n id: 'id'\n }\n publicIPAddress: {\n id: 'id'\n }\n }\n }\n ]\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-firewall", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:firewall} 'Microsoft.Network/azureFirewalls@2020-11-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n applicationRuleCollections: [\n {\n name: ${3:'name'}\n properties: {\n priority: ${4:'priority'}\n action: {\n type: '${5|Allow,Deny|}'\n }\n rules: [\n {\n name: ${6:'name'}\n description: ${7:'description'}\n sourceAddresses: [\n ${8:'sourceAddress'}\n ]\n protocols: [\n {\n protocolType: '${9|Http,Https,Mssql|}'\n port: ${10|80,443,1433|}\n }\n ]\n targetFqdns: [\n ${11:'www.microsoft.com'}\n ]\n }\n ]\n }\n }\n ]\n natRuleCollections: [\n {\n name: ${12:'name'}\n properties: {\n priority: ${13:'priority'}\n action: {\n type: '${14|Dnat, Snat|}'\n }\n rules: [\n {\n name: ${15:'name'}\n description: ${16:'description'}\n sourceAddresses: [\n ${17:'sourceAddress'}\n ]\n destinationAddresses: [\n ${18:'destinationAddress'}\n ]\n destinationPorts: [\n ${19:'port'}\n ]\n protocols: [\n '${20|TCP,UDP,Any,ICMP|}'\n ]\n translatedAddress: ${21:'translatedAddress'}\n translatedPort: ${22:'translatedPort'}\n }\n ]\n }\n }\n ]\n networkRuleCollections: [\n {\n name: ${23:'name'}\n properties: {\n priority: ${24:'priority'}\n action: {\n type: '${25|Deny,Allow|}'\n }\n rules: [\n {\n name: ${26:'name'}\n description: ${27:'description'}\n sourceAddresses: [\n ${28:'sourceAddress'}\n ]\n destinationAddresses: [\n ${29:'destinationAddress'}\n ]\n destinationPorts: [\n ${30:'destinationPort'}\n ]\n protocols: [\n '${31|TCP,UDP,Any,ICMP|}'\n ]\n }\n ]\n }\n }\n ]\n ipConfigurations: [\n {\n name: ${32:'name'}\n properties: {\n subnet: {\n id: ${33:'id'}\n }\n publicIPAddress: {\n id: ${34:'id'}\n }\n }\n }\n ]\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-firewall" + } + } + ] + } + }, { "label": "res-function", "kind": "snippet", @@ -1462,6 +1665,35 @@ ] } }, + { + "label": "res-plan", + "kind": "snippet", + "detail": "Application Service Plan (Server Farm)", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource appServicePlan 'Microsoft.Web/serverfarms@2020-12-01' = {\n name: 'name'\n location: resourceGroup().location\n sku: {\n name: 'name'\n capacity: capacity\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-plan", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:appServicePlan} 'Microsoft.Web/serverfarms@2020-12-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n sku: {\n name: ${3:'name'}\n capacity: ${4:capacity}\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-plan" + } + } + ] + } + }, { "label": "res-recovery-service-vault", "kind": "snippet", @@ -1665,6 +1897,35 @@ ] } }, + { + "label": "res-sql-server-firewall-rules", + "kind": "snippet", + "detail": "SQL Server Firewall Rules", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource sqlServer 'Microsoft.Sql/servers@2020-11-01-preview' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n administratorLogin: 'administratorLogin'\n administratorLoginPassword: 'administratorLoginPassword'\n }\n}\n\nresource sqlServerFirewallRules 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = {\n parent: sqlServer\n name: 'name'\n properties: {\n startIpAddress: 'startIpAddress'\n endIpAddress: 'endIpAddress'\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-sql-server-firewall-rules", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource sqlServer 'Microsoft.Sql/servers@2020-11-01-preview' = {\n name: ${1:'name'}\n location: resourceGroup().location\n properties: {\n administratorLogin: ${2:'administratorLogin'}\n administratorLoginPassword: ${3:'administratorLoginPassword'}\n }\n}\n\nresource ${4:sqlServerFirewallRules} 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = {\n parent: sqlServer\n name: ${5:'name'}\n properties: {\n startIpAddress: ${6:'startIpAddress'}\n endIpAddress: ${7:'endIpAddress'}\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-sql-server-firewall-rules" + } + } + ] + } + }, { "label": "res-storage", "kind": "snippet", @@ -1868,6 +2129,93 @@ ] } }, + { + "label": "res-vm-ubuntu", + "kind": "snippet", + "detail": "Ubuntu Virtual Machine", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource ubuntuVM 'Microsoft.Compute/virtualMachines@2020-12-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n hardwareProfile: {\n vmSize: 'Standard_A2_v2'\n }\n osProfile: {\n computerName: 'computerName'\n adminUsername: 'adminUsername'\n adminPassword: 'adminPassword'\n }\n storageProfile: {\n imageReference: {\n publisher: 'Canonical'\n offer: 'UbuntuServer'\n sku: '16.04-LTS'\n version: 'latest'\n }\n osDisk: {\n name: 'name'\n caching: 'ReadWrite'\n createOption: 'FromImage'\n }\n }\n networkProfile: {\n networkInterfaces: [\n {\n id: 'id'\n }\n ]\n }\n diagnosticsProfile: {\n bootDiagnostics: {\n enabled: true\n storageUri: 'storageUri'\n }\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-vm-ubuntu", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:ubuntuVM} 'Microsoft.Compute/virtualMachines@2020-12-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n hardwareProfile: {\n vmSize: 'Standard_A2_v2'\n }\n osProfile: {\n computerName: ${3:'computerName'}\n adminUsername: ${4:'adminUsername'}\n adminPassword: ${5:'adminPassword'}\n }\n storageProfile: {\n imageReference: {\n publisher: 'Canonical'\n offer: 'UbuntuServer'\n sku: '16.04-LTS'\n version: 'latest'\n }\n osDisk: {\n name: ${6:'name'}\n caching: 'ReadWrite'\n createOption: 'FromImage'\n }\n }\n networkProfile: {\n networkInterfaces: [\n {\n id: ${7:'id'}\n }\n ]\n }\n diagnosticsProfile: {\n bootDiagnostics: {\n enabled: true\n storageUri: ${8:'storageUri'}\n }\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-vm-ubuntu" + } + } + ] + } + }, + { + "label": "res-vm-windows", + "kind": "snippet", + "detail": "Windows Virtual Machine", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource windowsVM 'Microsoft.Compute/virtualMachines@2020-12-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n hardwareProfile: {\n vmSize: 'Standard_A2_v2'\n }\n osProfile: {\n computerName: 'computerName'\n adminUsername: 'adminUsername'\n adminPassword: 'adminPassword'\n }\n storageProfile: {\n imageReference: {\n publisher: 'MicrosoftWindowsServer'\n offer: 'WindowsServer'\n sku: '2012-R2-Datacenter'\n version: 'latest'\n }\n osDisk: {\n name: 'name'\n caching: 'ReadWrite'\n createOption: 'FromImage'\n }\n }\n networkProfile: {\n networkInterfaces: [\n {\n id: 'id'\n }\n ]\n }\n diagnosticsProfile: {\n bootDiagnostics: {\n enabled: true\n storageUri: 'storageUri'\n }\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-vm-windows", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:windowsVM} 'Microsoft.Compute/virtualMachines@2020-12-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n hardwareProfile: {\n vmSize: 'Standard_A2_v2'\n }\n osProfile: {\n computerName: ${3:'computerName'}\n adminUsername: ${4:'adminUsername'}\n adminPassword: ${5:'adminPassword'}\n }\n storageProfile: {\n imageReference: {\n publisher: 'MicrosoftWindowsServer'\n offer: 'WindowsServer'\n sku: '2012-R2-Datacenter'\n version: 'latest'\n }\n osDisk: {\n name: ${6:'name'}\n caching: 'ReadWrite'\n createOption: 'FromImage'\n }\n }\n networkProfile: {\n networkInterfaces: [\n {\n id: ${7:'id'}\n }\n ]\n }\n diagnosticsProfile: {\n bootDiagnostics: {\n enabled: true\n storageUri: ${8:'storageUri'}\n }\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-vm-windows" + } + } + ] + } + }, + { + "label": "res-vm-windows-diagnostics", + "kind": "snippet", + "detail": "Diagnostics Extension for a Windows Virtual Machine", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource windowsVMDiagnostics 'Microsoft.Compute/virtualMachines/extensions@2020-12-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n publisher: 'Microsoft.Azure.Diagnostics'\n type: 'IaaSDiagnostics'\n typeHandlerVersion: '1.5'\n autoUpgradeMinorVersion: true\n settings: {\n xmlCfg: base64(' ')\n storageAccount: 'storageAccount'\n }\n protectedSettings: {\n storageAccountName: 'storageAccountName'\n storageAccountKey: 'storageAccountKey'\n storageAccountEndPoint: 'storageAccountEndPoint'\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-vm-windows-diagnostics", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:windowsVMDiagnostics} 'Microsoft.Compute/virtualMachines/extensions@2020-12-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n publisher: 'Microsoft.Azure.Diagnostics'\n type: 'IaaSDiagnostics'\n typeHandlerVersion: '1.5'\n autoUpgradeMinorVersion: true\n settings: {\n xmlCfg: base64(' ')\n storageAccount: ${3:'storageAccount'}\n }\n protectedSettings: {\n storageAccountName: ${4:'storageAccountName'}\n storageAccountKey: ${5:'storageAccountKey'}\n storageAccountEndPoint: ${6:'storageAccountEndPoint'}\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-vm-windows-diagnostics" + } + } + ] + } + }, { "label": "res-vnet", "kind": "snippet", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusFor.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusFor.json index a725d307d4a..07007c72182 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusFor.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusFor.json @@ -100,10 +100,10 @@ { "label": "snippet", "kind": "snippet", - "detail": "DNS Zone", + "detail": "DNS Record", "documentation": { "kind": "markdown", - "value": "```bicep\n{\n name: 'name'\n location: 'global'\n}\n\n```" + "value": "```bicep\n{\n name: 'name'\n location: resourceGroup().location\n}\n\n```" }, "deprecated": false, "preselect": true, @@ -112,7 +112,7 @@ "insertTextMode": "adjustIndentation", "textEdit": { "range": {}, - "newText": "{\n name: ${2:'name'}\n location: 'global'\n}\n" + "newText": "{\n name: ${1:'name'}\n location: resourceGroup().location\n}\n" }, "command": { "command": "bicep.Telemetry", diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway-waf/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway-waf/main.bicep new file mode 100644 index 00000000000..280a3458a62 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway-waf/main.bicep @@ -0,0 +1,11 @@ +// $1 = applicationGatewayFirewall +// $2 = 'name' +// $3 = true +// $4 = 128 +// $5 = 100 +// $6 = Enabled +// $7 = Detection +// $8 = 'ruleSetType' +// $9 = 'ruleSetVersion' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway-waf/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway-waf/main.combined.bicep new file mode 100644 index 00000000000..545282ebadc --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway-waf/main.combined.bicep @@ -0,0 +1,22 @@ +resource applicationGatewayFirewall 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01' = { + name: 'name' + location: resourceGroup().location + properties: { + policySettings: { + requestBodyCheck: true + maxRequestBodySizeInKb: 128 + fileUploadLimitInMb: 100 + state: 'Enabled' + mode: 'Detection' + } + managedRules: { + managedRuleSets: [ + { + ruleSetType: 'ruleSetType' + ruleSetVersion: 'ruleSetVersion' + } + ] + } + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway/main.bicep new file mode 100644 index 00000000000..c8e9eb86fe2 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway/main.bicep @@ -0,0 +1,26 @@ +// $1 = applicationGateway +// $2 = 'name' +// $3 = Standard_Small +// $4 = Standard +// $5 = 2 +// $6 = 'name' +// $7 = 'id' +// $8 = 'name' +// $9 = 'id' +// $10 = 'name' +// $11 = 80 +// $12 = 'name' +// $13 = 'name' +// $14 = 80 +// $15 = Http +// $16 = 'name' +// $17 = 'id' +// $18 = 'id' +// $19 = Http +// $20 = 'name' +// $21 = Basic +// $22 = 'id' +// $23 = 'id' +// $24 = 'id' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway/main.combined.bicep new file mode 100644 index 00000000000..27df606a7f9 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-gateway/main.combined.bicep @@ -0,0 +1,87 @@ +resource applicationGateway 'Microsoft.Network/applicationGateways@2020-11-01' = { + name: 'name' + location: resourceGroup().location + properties: { + sku: { + name: 'Standard_Small' + tier: 'Standard' + capacity: 2 + } + gatewayIPConfigurations: [ + { + name: 'name' + properties: { + subnet: { + id: 'id' + } + } + } + ] + frontendIPConfigurations: [ + { + name: 'name' + properties: { + publicIPAddress: { + id: 'id' + } + } + } + ] + frontendPorts: [ + { + name: 'name' + properties: { + port: 80 + } + } + ] + backendAddressPools: [ + { + name: 'name' + } + ] + backendHttpSettingsCollection: [ + { + name: 'name' + properties: { + port: 80 + protocol: 'Http' + cookieBasedAffinity: 'Disabled' + } + } + ] + httpListeners: [ + { + name: 'name' + properties: { + frontendIPConfiguration: { + id: 'id' + } + frontendPort: { + id: 'id' + } + protocol: 'Http' + sslCertificate: null + } + } + ] + requestRoutingRules: [ + { + name: 'name' + properties: { + ruleType: 'Basic' + httpListener: { + id: 'id' + } + backendAddressPool: { + id: 'id' + } + backendHttpSettings: { + id: 'id' + } + } + } + ] + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-alert-rules/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-alert-rules/main.bicep new file mode 100644 index 00000000000..ba67f85b539 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-alert-rules/main.bicep @@ -0,0 +1,12 @@ +// $1 = appInsightsAlertRules +// $2 = 'name' +// $3 = 'name' +// $4 = 'description' +// $5 = 3 +// $6 = Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition +// $7 = Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource +// $8 = 'resourceUri' +// $9 = 'windowSize' +// $10 = Microsoft.Azure.Management.Insights.Models.RuleEmailAction + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-alert-rules/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-alert-rules/main.combined.bicep new file mode 100644 index 00000000000..4bc259d16d6 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-alert-rules/main.combined.bicep @@ -0,0 +1,23 @@ +resource appInsightsAlertRules 'Microsoft.Insights/alertrules@2016-03-01' = { + name: 'name' + location: resourceGroup().location + properties: { + name: 'name' + description: 'description' + isEnabled: false + condition: { + failedLocationCount: 3 + 'odata.type': 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition' + dataSource: { + 'odata.type': 'Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource' + resourceUri: 'resourceUri' + } + windowSize: 'windowSize' + } + action: { + 'odata.type': 'Microsoft.Azure.Management.Insights.Models.RuleEmailAction' + sendToServiceOwners: true + } + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-auto-scale-settings/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-auto-scale-settings/main.bicep new file mode 100644 index 00000000000..7ea69f062b7 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-auto-scale-settings/main.bicep @@ -0,0 +1,18 @@ +// $1 = appInsightsAutoScaleSettings +// $2 = 'name' +// $3 = web +// $4 = appServiceId +// $5 = 'name' +// $6 = 'name' +// $7 = 'minimum' +// $8 = 'maximum' +// $9 = 'default' +// $10 = 'name' +// $11 = 'metricResourceUri' +// $12 = 'value' +// $13 = 'metricName' +// $14 = 'metricResourceUri' +// $15 = 'value' +// $16 = 'metricResourceUri' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-auto-scale-settings/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-auto-scale-settings/main.combined.bicep new file mode 100644 index 00000000000..99d36e87910 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights-auto-scale-settings/main.combined.bicep @@ -0,0 +1,62 @@ +resource appInsightsAutoScaleSettings 'Microsoft.Insights/autoscalesettings@2015-04-01' = { + name: 'name' + location: resourceGroup().location + tags: { + Application_Type: 'web' + 'hidden-link:appServiceId': 'Resource' + } + properties: { + name: 'name' + profiles: [ + { + name: 'name' + capacity: { + minimum: 'minimum' + maximum: 'maximum' + default: 'default' + } + rules: [ + { + metricTrigger: { + metricName: 'name' + metricResourceUri: 'metricResourceUri' + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT10M' + timeAggregation: 'Average' + operator: 'GreaterThan' + threshold: 80 + } + scaleAction: { + direction: 'Increase' + type: 'ChangeCount' + value: 'value' + cooldown: 'PT10M' + } + } + { + metricTrigger: { + metricName: 'metricName' + metricResourceUri: 'metricResourceUri' + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT1H' + timeAggregation: 'Average' + operator: 'LessThan' + threshold: 60 + } + scaleAction: { + direction: 'Decrease' + type: 'ChangeCount' + value: 'value' + cooldown: 'PT1H' + } + } + ] + } + ] + enabled: false + targetResourceUri: 'metricResourceUri' + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights/main.bicep new file mode 100644 index 00000000000..7fa81fb8bb6 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights/main.bicep @@ -0,0 +1,5 @@ +// $1 = appInsightsComponents +// $2 = 'name' +// $3 = web + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights/main.combined.bicep new file mode 100644 index 00000000000..aeb8e3884f2 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-app-insights/main.combined.bicep @@ -0,0 +1,9 @@ +resource appInsightsComponents 'Microsoft.Insights/components@2020-02-02-preview' = { + name: 'name' + location: resourceGroup().location + kind: 'web' + properties: { + Application_Type: 'web' + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-dns-record/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-dns-record/main.bicep new file mode 100644 index 00000000000..6dfd5551cc1 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-dns-record/main.bicep @@ -0,0 +1,7 @@ +// $1 = 'name' +// $2 = dnsRecord +// $3 = A +// $4 = 'name' +// $5 = ARecords + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-dns-record/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-dns-record/main.combined.bicep new file mode 100644 index 00000000000..80ab4571883 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-dns-record/main.combined.bicep @@ -0,0 +1,14 @@ +resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = { + name: 'name' + location: resourceGroup().location +} + +resource dnsRecord 'Microsoft.Network/dnsZones/A@2018-05-01' = { + parent: dnsZone + name: 'name' + properties: { + TTL: 3600 + 'ARecords': [] + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-firewall/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-firewall/main.bicep new file mode 100644 index 00000000000..1e143f35a0e --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-firewall/main.bicep @@ -0,0 +1,36 @@ +// $1 = firewall +// $2 = 'name' +// $3 = 'name' +// $4 = 100 +// $5 = Allow +// $6 = 'name' +// $7 = 'description' +// $8 = 'sourceAddress' +// $9 = Http +// $10 = 80 +// $11 = 'www.microsoft.com' +// $12 = 'name' +// $13 = 100 +// $14 = Dnat +// $15 = 'name' +// $16 = 'description' +// $17 = 'sourceAddress' +// $18 = 'destinationAddress' +// $19 = '80' +// $20 = TCP +// $21 = 'translatedAddress' +// $22 = '80' +// $23 = 'name' +// $24 = 100 +// $25 = Deny +// $26 = 'name' +// $27 = 'description' +// $28 = 'sourceAddress' +// $29 = 'destinationAddress' +// $30 = '80' +// $31 = TCP +// $32 = 'name' +// $33 = 'id' +// $34 = 'id' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-firewall/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-firewall/main.combined.bicep new file mode 100644 index 00000000000..faf36fd9842 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-firewall/main.combined.bicep @@ -0,0 +1,109 @@ +resource firewall 'Microsoft.Network/azureFirewalls@2020-11-01' = { + name: 'name' + location: resourceGroup().location + properties: { + applicationRuleCollections: [ + { + name: 'name' + properties: { + priority: 100 + action: { + type: 'Allow' + } + rules: [ + { + name: 'name' + description: 'description' + sourceAddresses: [ + 'sourceAddress' + ] + protocols: [ + { + protocolType: 'Http' + port: 80 + } + ] + targetFqdns: [ + 'www.microsoft.com' + ] + } + ] + } + } + ] + natRuleCollections: [ + { + name: 'name' + properties: { + priority: 100 + action: { + type: 'Dnat' + } + rules: [ + { + name: 'name' + description: 'description' + sourceAddresses: [ + 'sourceAddress' + ] + destinationAddresses: [ + 'destinationAddress' + ] + destinationPorts: [ + '80' + ] + protocols: [ + 'TCP' + ] + translatedAddress: 'translatedAddress' + translatedPort: '80' + } + ] + } + } + ] + networkRuleCollections: [ + { + name: 'name' + properties: { + priority: 100 + action: { + type: 'Deny' + } + rules: [ + { + name: 'name' + description: 'description' + sourceAddresses: [ + 'sourceAddress' + ] + destinationAddresses: [ + 'destinationAddress' + ] + destinationPorts: [ + '80' + ] + protocols: [ + 'TCP' + ] + } + ] + } + } + ] + ipConfigurations: [ + { + name: 'name' + properties: { + subnet: { + id: 'id' + } + publicIPAddress: { + id: 'id' + } + } + } + ] + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-plan/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-plan/main.bicep new file mode 100644 index 00000000000..142f4152b7e --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-plan/main.bicep @@ -0,0 +1,6 @@ +// $1 = appServicePlan +// $2 = 'name' +// $3 = 'name' +// $4 = 1 + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-plan/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-plan/main.combined.bicep new file mode 100644 index 00000000000..54eb40e0334 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-plan/main.combined.bicep @@ -0,0 +1,9 @@ +resource appServicePlan 'Microsoft.Web/serverfarms@2020-12-01' = { + name: 'name' + location: resourceGroup().location + sku: { + name: 'name' + capacity: 1 + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-sql-server-firewall-rules/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-sql-server-firewall-rules/main.bicep new file mode 100644 index 00000000000..1116f55ae8a --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-sql-server-firewall-rules/main.bicep @@ -0,0 +1,9 @@ +// $1 = 'name' +// $2 = 'administratorLogin' +// $3 = 'administratorLoginPassword' +// $4 = sqlServerFirewallRules +// $5 = 'name' +// $6 = 'startIpAddress' +// $7 = 'endIpAddress' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-sql-server-firewall-rules/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-sql-server-firewall-rules/main.combined.bicep new file mode 100644 index 00000000000..b2059ca72c7 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-sql-server-firewall-rules/main.combined.bicep @@ -0,0 +1,18 @@ +resource sqlServer 'Microsoft.Sql/servers@2020-11-01-preview' = { + name: 'name' + location: resourceGroup().location + properties: { + administratorLogin: 'administratorLogin' + administratorLoginPassword: 'administratorLoginPassword' + } +} + +resource sqlServerFirewallRules 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = { + parent: sqlServer + name: 'name' + properties: { + startIpAddress: 'startIpAddress' + endIpAddress: 'endIpAddress' + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-ubuntu/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-ubuntu/main.bicep new file mode 100644 index 00000000000..e5e7bf20175 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-ubuntu/main.bicep @@ -0,0 +1,10 @@ +// $1 = ubuntuVM +// $2 = 'name' +// $3 = 'computerName' +// $4 = 'adminUsername' +// $5 = 'adminPassword' +// $6 = 'name' +// $7 = 'id' +// $8 = 'storageUri' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-ubuntu/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-ubuntu/main.combined.bicep new file mode 100644 index 00000000000..272d806de64 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-ubuntu/main.combined.bicep @@ -0,0 +1,41 @@ +resource ubuntuVM 'Microsoft.Compute/virtualMachines@2020-12-01' = { + name: 'name' + location: resourceGroup().location + properties: { + hardwareProfile: { + vmSize: 'Standard_A2_v2' + } + osProfile: { + computerName: 'computerName' + adminUsername: 'adminUsername' + adminPassword: 'adminPassword' + } + storageProfile: { + imageReference: { + publisher: 'Canonical' + offer: 'UbuntuServer' + sku: '16.04-LTS' + version: 'latest' + } + osDisk: { + name: 'name' + caching: 'ReadWrite' + createOption: 'FromImage' + } + } + networkProfile: { + networkInterfaces: [ + { + id: 'id' + } + ] + } + diagnosticsProfile: { + bootDiagnostics: { + enabled: true + storageUri: 'storageUri' + } + } + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows-diagnostics/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows-diagnostics/main.bicep new file mode 100644 index 00000000000..c6ba7e73d87 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows-diagnostics/main.bicep @@ -0,0 +1,8 @@ +// $1 = windowsVMDiagnostics +// $2 = 'windowsVM/Diagnostics' +// $3 = 'storageAccount' +// $4 = 'storageAccountName' +// $5 = 'storageAccountKey' +// $6 = 'storageAccountEndPoint' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows-diagnostics/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows-diagnostics/main.combined.bicep new file mode 100644 index 00000000000..aa11ce36dda --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows-diagnostics/main.combined.bicep @@ -0,0 +1,20 @@ +resource windowsVMDiagnostics 'Microsoft.Compute/virtualMachines/extensions@2020-12-01' = { + name: 'windowsVM/Diagnostics' + location: resourceGroup().location + properties: { + publisher: 'Microsoft.Azure.Diagnostics' + type: 'IaaSDiagnostics' + typeHandlerVersion: '1.5' + autoUpgradeMinorVersion: true + settings: { + xmlCfg: base64(' ') + storageAccount: 'storageAccount' + } + protectedSettings: { + storageAccountName: 'storageAccountName' + storageAccountKey: 'storageAccountKey' + storageAccountEndPoint: 'storageAccountEndPoint' + } + } +} + diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows/main.bicep new file mode 100644 index 00000000000..72afbaa7e8b --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows/main.bicep @@ -0,0 +1,10 @@ +// $1 = windowsVM +// $2 = 'name' +// $3 = 'computerName' +// $4 = 'adminUsername' +// $5 = 'adminPassword' +// $6 = 'name' +// $7 = 'id' +// $8 = 'storageUri' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows/main.combined.bicep new file mode 100644 index 00000000000..bdd419d4d74 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-vm-windows/main.combined.bicep @@ -0,0 +1,41 @@ +resource windowsVM 'Microsoft.Compute/virtualMachines@2020-12-01' = { + name: 'name' + location: resourceGroup().location + properties: { + hardwareProfile: { + vmSize: 'Standard_A2_v2' + } + osProfile: { + computerName: 'computerName' + adminUsername: 'adminUsername' + adminPassword: 'adminPassword' + } + storageProfile: { + imageReference: { + publisher: 'MicrosoftWindowsServer' + offer: 'WindowsServer' + sku: '2012-R2-Datacenter' + version: 'latest' + } + osDisk: { + name: 'name' + caching: 'ReadWrite' + createOption: 'FromImage' + } + } + networkProfile: { + networkInterfaces: [ + { + id: 'id' + } + ] + } + diagnosticsProfile: { + bootDiagnostics: { + enabled: true + storageUri: 'storageUri' + } + } + } +} + diff --git a/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs b/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs index dcaa3bcd8f9..92934c6c029 100644 --- a/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs +++ b/src/Bicep.LangServer.UnitTests/Snippets/SnippetsProviderTests.cs @@ -151,9 +151,9 @@ public void GetResourceBodyCompletionSnippets_WithStaticTemplateAndNoResourceDep { SnippetsProvider snippetsProvider = new SnippetsProvider(); TypeSymbol typeSymbol = new ResourceType( - ResourceTypeReference.Parse("Microsoft.Network/dnsZones@2018-05-01"), + ResourceTypeReference.Parse("Microsoft.DataLakeStore/accounts@2016-11-01"), ResourceScope.ResourceGroup, - CreateObjectType("Microsoft.Network/dnsZones@2018-05-01", + CreateObjectType("Microsoft.DataLakeStore/accounts@2016-11-01", ("name", LanguageConstants.String, TypePropertyFlags.Required), ("location", LanguageConstants.String, TypePropertyFlags.Required))); @@ -170,11 +170,15 @@ public void GetResourceBodyCompletionSnippets_WithStaticTemplateAndNoResourceDep x => { x.Prefix.Should().Be("snippet"); - x.Detail.Should().Be("DNS Zone"); + x.Detail.Should().Be("Data Lake Store Account"); x.CompletionPriority.Should().Be(CompletionPriority.Medium); x.Text.Should().BeEquivalentToIgnoringNewlines(@"{ name: ${2:'name'} - location: 'global' + location: resourceGroup().location + properties: { + newTier: ${3|'Consumption','Commitment_1TB','Commitment_10TB','Commitment_100TB','Commitment_500TB','Commitment_1PB','Commitment_5PB'|} + encryptionState: ${4|'Enabled','Disabled'|} + } } "); }, diff --git a/src/Bicep.LangServer/Snippets/Templates/res-app-gateway-waf.bicep b/src/Bicep.LangServer/Snippets/Templates/res-app-gateway-waf.bicep new file mode 100644 index 00000000000..404deca4824 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-app-gateway-waf.bicep @@ -0,0 +1,22 @@ +// Application Gateway with Web Application Firewall +resource ${1:applicationGatewayFirewall} 'Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies@2020-11-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + policySettings: { + requestBodyCheck: ${3|true,false|} + maxRequestBodySizeInKb: ${4:'maxRequestBodySizeInKb'} + fileUploadLimitInMb: ${5:'fileUploadLimitInMb'} + state: '${6|Enabled,Disabled|}' + mode: '${7|Detection,Prevention|}' + } + managedRules: { + managedRuleSets: [ + { + ruleSetType: ${8:'ruleSetType'} + ruleSetVersion: ${9:'ruleSetVersion'} + } + ] + } + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-app-gateway.bicep b/src/Bicep.LangServer/Snippets/Templates/res-app-gateway.bicep new file mode 100644 index 00000000000..80afcfd0a40 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-app-gateway.bicep @@ -0,0 +1,87 @@ +// Application Gateway +resource ${1:applicationGateway} 'Microsoft.Network/applicationGateways@2020-11-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + sku: { + name: '${3|Standard_Small,Standard_Medium,Standard_Large,WAF_Medium,WAF_Large,Standard_v2,WAF_v2|}' + tier: '${4|Standard,WAF,Standard_v2,WAF_v2|}' + capacity: ${5:'capacity'} + } + gatewayIPConfigurations: [ + { + name: ${6:'name'} + properties: { + subnet: { + id: ${7:'id'} + } + } + } + ] + frontendIPConfigurations: [ + { + name: ${8:'name'} + properties: { + publicIPAddress: { + id: ${9:'id'} + } + } + } + ] + frontendPorts: [ + { + name: ${10:'name'} + properties: { + port: ${11:'port'} + } + } + ] + backendAddressPools: [ + { + name: ${12:'name'} + } + ] + backendHttpSettingsCollection: [ + { + name: ${13:'name'} + properties: { + port: ${14:'port'} + protocol: '${15|Http,Https|}' + cookieBasedAffinity: 'Disabled' + } + } + ] + httpListeners: [ + { + name: ${16:'name'} + properties: { + frontendIPConfiguration: { + id: ${17:'id'} + } + frontendPort: { + id: ${18:'id'} + } + protocol: '${19|Http,Https|}' + sslCertificate: null + } + } + ] + requestRoutingRules: [ + { + name: ${20:'name'} + properties: { + ruleType: '${21|Basic,PathBasedRouting|}' + httpListener: { + id: ${22:'id'} + } + backendAddressPool: { + id: ${23:'id'} + } + backendHttpSettings: { + id: ${24:'id'} + } + } + } + ] + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-app-insights-alert-rules.bicep b/src/Bicep.LangServer/Snippets/Templates/res-app-insights-alert-rules.bicep new file mode 100644 index 00000000000..c0486551e6a --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-app-insights-alert-rules.bicep @@ -0,0 +1,23 @@ +// Application Insights Alert Rules +resource ${1:appInsightsAlertRules} 'Microsoft.Insights/alertrules@2016-03-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + name: ${3:'name'} + description: ${4:'description'} + isEnabled: false + condition: { + failedLocationCount: ${5:'failedLocationCount'} + 'odata.type': '${6|Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition,Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition,Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition|}' + dataSource: { + 'odata.type': '${7|Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource,Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource|}' + resourceUri: ${8:'resourceUri'} + } + windowSize: ${9:'windowSize'} + } + action: { + 'odata.type': '${10|Microsoft.Azure.Management.Insights.Models.RuleEmailAction,Microsoft.Azure.Management.Insights.Models.RuleWebhookAction|}' + sendToServiceOwners: true + } + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-app-insights-auto-scale-settings.bicep b/src/Bicep.LangServer/Snippets/Templates/res-app-insights-auto-scale-settings.bicep new file mode 100644 index 00000000000..d666bdf614c --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-app-insights-auto-scale-settings.bicep @@ -0,0 +1,62 @@ +// Application Insights Auto Scale Settings +resource ${1:appInsightsAutoScaleSettings} 'Microsoft.Insights/autoscalesettings@2015-04-01' = { + name: ${2:'name'} + location: resourceGroup().location + tags: { + Application_Type: '${3|web,other|}' + 'hidden-link:${4:appServiceId}': 'Resource' + } + properties: { + name: ${5:'name'} + profiles: [ + { + name: ${6:'name'} + capacity: { + minimum: ${7:'minimum'} + maximum: ${8:'maximum'} + default: ${9:'default'} + } + rules: [ + { + metricTrigger: { + metricName: ${10:'name'} + metricResourceUri: ${11:'metricResourceUri'} + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT10M' + timeAggregation: 'Average' + operator: 'GreaterThan' + threshold: 80 + } + scaleAction: { + direction: 'Increase' + type: 'ChangeCount' + value: ${12:'value'} + cooldown: 'PT10M' + } + } + { + metricTrigger: { + metricName: ${13:'metricName'} + metricResourceUri: ${14:'metricResourceUri'} + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT1H' + timeAggregation: 'Average' + operator: 'LessThan' + threshold: 60 + } + scaleAction: { + direction: 'Decrease' + type: 'ChangeCount' + value: ${15:'value'} + cooldown: 'PT1H' + } + } + ] + } + ] + enabled: false + targetResourceUri: ${16:'targetResourceUri'} + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-app-insights.bicep b/src/Bicep.LangServer/Snippets/Templates/res-app-insights.bicep new file mode 100644 index 00000000000..b763d9554aa --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-app-insights.bicep @@ -0,0 +1,9 @@ +// Application Insights for Web Apps +resource ${1:appInsightsComponents} 'Microsoft.Insights/components@2020-02-02-preview' = { + name: ${2:'name'} + location: resourceGroup().location + kind: 'web' + properties: { + Application_Type: '${3|web,other|}' + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-dns-record.bicep b/src/Bicep.LangServer/Snippets/Templates/res-dns-record.bicep new file mode 100644 index 00000000000..37bf86f3d84 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-dns-record.bicep @@ -0,0 +1,14 @@ +// DNS Record +resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = { + name: ${1:'name'} + location: resourceGroup().location +} + +resource ${2:dnsRecord} 'Microsoft.Network/dnsZones/${3|A,AAAA,CNAME,MX,NS,PTR,SOA,SRV,TXT|}@2018-05-01' = { + parent: dnsZone + name: ${4:'name'} + properties: { + TTL: 3600 + '${5|ARecords,AAAARecords,MXRecords,NSRecords,PTRRecords,SRVRecords,TXTRecords,CNAMERecord,SOARecord|}': [] + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-firewall.bicep b/src/Bicep.LangServer/Snippets/Templates/res-firewall.bicep new file mode 100644 index 00000000000..05415836f92 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-firewall.bicep @@ -0,0 +1,109 @@ +// Azure Firewall +resource ${1:firewall} 'Microsoft.Network/azureFirewalls@2020-11-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + applicationRuleCollections: [ + { + name: ${3:'name'} + properties: { + priority: ${4:'priority'} + action: { + type: '${5|Allow,Deny|}' + } + rules: [ + { + name: ${6:'name'} + description: ${7:'description'} + sourceAddresses: [ + ${8:'sourceAddress'} + ] + protocols: [ + { + protocolType: '${9|Http,Https,Mssql|}' + port: ${10|80,443,1433|} + } + ] + targetFqdns: [ + ${11:'www.microsoft.com'} + ] + } + ] + } + } + ] + natRuleCollections: [ + { + name: ${12:'name'} + properties: { + priority: ${13:'priority'} + action: { + type: '${14|Dnat, Snat|}' + } + rules: [ + { + name: ${15:'name'} + description: ${16:'description'} + sourceAddresses: [ + ${17:'sourceAddress'} + ] + destinationAddresses: [ + ${18:'destinationAddress'} + ] + destinationPorts: [ + ${19:'port'} + ] + protocols: [ + '${20|TCP,UDP,Any,ICMP|}' + ] + translatedAddress: ${21:'translatedAddress'} + translatedPort: ${22:'translatedPort'} + } + ] + } + } + ] + networkRuleCollections: [ + { + name: ${23:'name'} + properties: { + priority: ${24:'priority'} + action: { + type: '${25|Deny,Allow|}' + } + rules: [ + { + name: ${26:'name'} + description: ${27:'description'} + sourceAddresses: [ + ${28:'sourceAddress'} + ] + destinationAddresses: [ + ${29:'destinationAddress'} + ] + destinationPorts: [ + ${30:'destinationPort'} + ] + protocols: [ + '${31|TCP,UDP,Any,ICMP|}' + ] + } + ] + } + } + ] + ipConfigurations: [ + { + name: ${32:'name'} + properties: { + subnet: { + id: ${33:'id'} + } + publicIPAddress: { + id: ${34:'id'} + } + } + } + ] + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-plan.bicep b/src/Bicep.LangServer/Snippets/Templates/res-plan.bicep new file mode 100644 index 00000000000..2680e06881d --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-plan.bicep @@ -0,0 +1,9 @@ +// Application Service Plan (Server Farm) +resource ${1:appServicePlan} 'Microsoft.Web/serverfarms@2020-12-01' = { + name: ${2:'name'} + location: resourceGroup().location + sku: { + name: ${3:'name'} + capacity: ${4:capacity} + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-sql-server-firewall-rules.bicep b/src/Bicep.LangServer/Snippets/Templates/res-sql-server-firewall-rules.bicep new file mode 100644 index 00000000000..fd2fd1feadf --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-sql-server-firewall-rules.bicep @@ -0,0 +1,18 @@ +// SQL Server Firewall Rules +resource sqlServer 'Microsoft.Sql/servers@2020-11-01-preview' = { + name: ${1:'name'} + location: resourceGroup().location + properties: { + administratorLogin: ${2:'administratorLogin'} + administratorLoginPassword: ${3:'administratorLoginPassword'} + } +} + +resource ${4:sqlServerFirewallRules} 'Microsoft.Sql/servers/firewallRules@2020-11-01-preview' = { + parent: sqlServer + name: ${5:'name'} + properties: { + startIpAddress: ${6:'startIpAddress'} + endIpAddress: ${7:'endIpAddress'} + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-vm-ubuntu.bicep b/src/Bicep.LangServer/Snippets/Templates/res-vm-ubuntu.bicep new file mode 100644 index 00000000000..353a4b117a2 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-vm-ubuntu.bicep @@ -0,0 +1,41 @@ +// Ubuntu Virtual Machine +resource ${1:ubuntuVM} 'Microsoft.Compute/virtualMachines@2020-12-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + hardwareProfile: { + vmSize: 'Standard_A2_v2' + } + osProfile: { + computerName: ${3:'computerName'} + adminUsername: ${4:'adminUsername'} + adminPassword: ${5:'adminPassword'} + } + storageProfile: { + imageReference: { + publisher: 'Canonical' + offer: 'UbuntuServer' + sku: '16.04-LTS' + version: 'latest' + } + osDisk: { + name: ${6:'name'} + caching: 'ReadWrite' + createOption: 'FromImage' + } + } + networkProfile: { + networkInterfaces: [ + { + id: ${7:'id'} + } + ] + } + diagnosticsProfile: { + bootDiagnostics: { + enabled: true + storageUri: ${8:'storageUri'} + } + } + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-vm-windows-diagnostics.bicep b/src/Bicep.LangServer/Snippets/Templates/res-vm-windows-diagnostics.bicep new file mode 100644 index 00000000000..86b2adafea1 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-vm-windows-diagnostics.bicep @@ -0,0 +1,20 @@ +// Diagnostics Extension for a Windows Virtual Machine +resource ${1:windowsVMDiagnostics} 'Microsoft.Compute/virtualMachines/extensions@2020-12-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + publisher: 'Microsoft.Azure.Diagnostics' + type: 'IaaSDiagnostics' + typeHandlerVersion: '1.5' + autoUpgradeMinorVersion: true + settings: { + xmlCfg: base64(' ') + storageAccount: ${3:'storageAccount'} + } + protectedSettings: { + storageAccountName: ${4:'storageAccountName'} + storageAccountKey: ${5:'storageAccountKey'} + storageAccountEndPoint: ${6:'storageAccountEndPoint'} + } + } +} diff --git a/src/Bicep.LangServer/Snippets/Templates/res-vm-windows.bicep b/src/Bicep.LangServer/Snippets/Templates/res-vm-windows.bicep new file mode 100644 index 00000000000..3d366082c1c --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-vm-windows.bicep @@ -0,0 +1,41 @@ +// Windows Virtual Machine +resource ${1:windowsVM} 'Microsoft.Compute/virtualMachines@2020-12-01' = { + name: ${2:'name'} + location: resourceGroup().location + properties: { + hardwareProfile: { + vmSize: 'Standard_A2_v2' + } + osProfile: { + computerName: ${3:'computerName'} + adminUsername: ${4:'adminUsername'} + adminPassword: ${5:'adminPassword'} + } + storageProfile: { + imageReference: { + publisher: 'MicrosoftWindowsServer' + offer: 'WindowsServer' + sku: '2012-R2-Datacenter' + version: 'latest' + } + osDisk: { + name: ${6:'name'} + caching: 'ReadWrite' + createOption: 'FromImage' + } + } + networkProfile: { + networkInterfaces: [ + { + id: ${7:'id'} + } + ] + } + diagnosticsProfile: { + bootDiagnostics: { + enabled: true + storageUri: ${8:'storageUri'} + } + } + } +}