Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.publicIp = new azure.network.PublicIp(`${name}-ip`, {
resourceGroupName: args.resourceGroupName,
allocationMethod: "Dynamic",
}, { parent: this });
this.networkInterface = new azure.network.NetworkInterface(`${name}-nic`, {
resourceGroupName: args.resourceGroupName,
ipConfigurations: [{
name: "webserveripcfg",
subnetId: args.subnetId,
privateIpAddressAllocation: "Dynamic",
publicIpAddressId: this.publicIp.id,
}],
}, { parent: this });
// Now create the VM, using the resource group and NIC allocated above.
this.vm = new azure.compute.VirtualMachine(`${name}-vm`, {
resourceGroupName: args.resourceGroupName,
networkInterfaceIds: [this.networkInterface.id],
vmSize: args.vmSize || "Standard_A0",
deleteDataDisksOnTermination: true,
deleteOsDiskOnTermination: true,
osProfile: {
computerName: "hostname",
adminUsername: args.username,
adminPassword: args.password,
customData: args.bootScript,
},
osProfileLinuxConfig: {
disablePasswordAuthentication: false,
},
storageOsDisk: {
createOption: "FromImage",resourceGroupName,
allocationMethod: "Dynamic",
});
const networkInterface = new azure.network.NetworkInterface("server-nic", {
resourceGroupName,
ipConfigurations: [{
name: "webserveripcfg",
subnetId: network.subnets[0].id,
privateIpAddressAllocation: "Dynamic",
publicIpAddressId: publicIp.id,
}],
});
// Now create the VM, using the resource group and NIC allocated above.
const vm = new azure.compute.VirtualMachine("server-vm", {
resourceGroupName,
networkInterfaceIds: [networkInterface.id],
vmSize: "Standard_A0",
deleteDataDisksOnTermination: true,
deleteOsDiskOnTermination: true,
osProfile: {
computerName: "hostname",
adminUsername: username,
adminPassword: password,
customData: `#!/bin/bash\n
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &`,
},
osProfileLinuxConfig: {
disablePasswordAuthentication: false,
},protocol: "Tcp",
});
const vnet = new azure.network.VirtualNetwork("vnet", {
resourceGroupName: resourceGroup.name,
addressSpaces: ["10.0.0.0/16"],
});
const subnet = new azure.network.Subnet("subnet", {
enforcePrivateLinkEndpointNetworkPolicies: false,
resourceGroupName: resourceGroup.name,
addressPrefix: "10.0.2.0/24",
virtualNetworkName: vnet.name,
});
const scaleSet = new azure.compute.ScaleSet("vmscaleset", {
resourceGroupName: resourceGroup.name,
networkProfiles: [{
ipConfigurations: [{
loadBalancerBackendAddressPoolIds: [bpepool.id],
name: "IPConfiguration",
primary: true,
subnetId: subnet.id,
}],
name: "networkprofile",
primary: true,
}],
osProfile: {
adminUsername: adminUser,
adminPassword,
computerNamePrefix: "vmlab",
customData:let networkInterface = new azure.network.NetworkInterface("server-nic", {
resourceGroupName: resourceGroup.name,
ipConfigurations: [{
name: "webserveripcfg",
subnetId: network.subnets[0].id,
privateIpAddressAllocation: "Dynamic",
publicIpAddressId: publicIP.id,
}],
});
let userData =
`#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &`;
let vm = new azure.compute.VirtualMachine("server-vm", {
resourceGroupName: resourceGroup.name,
networkInterfaceIds: [networkInterface.id],
vmSize: "Standard_A0",
deleteDataDisksOnTermination: true,
deleteOsDiskOnTermination: true,
osProfile: {
computerName: "hostname",
adminUsername: username,
adminPassword: password,
customData: userData,
},
osProfileLinuxConfig: {
disablePasswordAuthentication: false,
},
storageOsDisk: {
createOption: "FromImage","use strict";
const pulumi = require("@pulumi/pulumi");
const azure = require("@pulumi/azure");
let config = new pulumi.Config();
const vmssName = config.require("vmss-name");
const vmssId = config.require("vmss-id");
const vmss = azure.compute.ScaleSet.get(vmssName, vmssId);resourceGroupName: resourceGroup.name,
addressPrefix: "10.0.2.0/24",
virtualNetworkName: vnet.name,
}, opts);
const customData = pulumi.all([cosmosAccount.endpoint, cosmosAccount.primaryMasterKey, database.name, container.name])
.apply(([endpoint, key, databaseName, collectionName]) => {
const s = file.replace("${ENDPOINT}", endpoint)
.replace("${MASTER_KEY}", key)
.replace("${DATABASE}", databaseName)
.replace("${COLLECTION}", collectionName)
.replace("${LOCATION}", location);
return s;
});
const scaleSet = new azure.compute.ScaleSet(`vmss-${location}`, {
resourceGroupName: resourceGroup.name,
location,
networkProfiles: [{
ipConfigurations: [{
loadBalancerBackendAddressPoolIds: [bpepool.id],
name: "IPConfiguration",
primary: true,
subnetId: subnet.id,
}],
name: "networkprofile",
primary: true,
}],
osProfile: {
adminUsername: "neo",
adminPassword: "SEcurePwd$3",
computerNamePrefix: "lab",