// Set up SSH public key String fullStorePath = " ~/.ssh/authorized_keys"; String sshKeyData = "you-ssh-key-data"; SshPublicKey sshPublicKey = new SshPublicKey(); sshPublicKey.setPath(fullStorePath); sshPublicKey.setKeyData(sshKeyData); // SShConfiguration ArrayList<SshPublicKey> keyList = new ArrayList<SshPublicKey>(); keyList.add(sshPublicKey); SshConfiguration sshConfig = new SshConfiguration(); sshconfig.setPublicKeys(keyList); // Linux Configuration Bool shouldDisablePasswordAuthentication = False; LinuxConfiguration linuxConfig = new LinuxConfiguration(); linuxConfig.setSsh(sshConfig); linuxConfig.setDisablePasswordAuthentication(shouldDisablePasswordAuthentication); // set your OSProfile now request.getOsProfile().setLinuxConfiguration(linuxConfig); // you code goes here
@Override public VirtualMachineImpl withSpecificLinuxImageVersion(ImageReference imageReference) { this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReference); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineImpl withSpecificLinuxImageVersion(ImageReference imageReference) { this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReference); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReferenceInner); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReferenceInner); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineScaleSetImpl withSpecificLinuxImageVersion(ImageReference imageReference) { this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().withImageReference(imageReference); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineScaleSetImpl withSpecificLinuxImageVersion(ImageReference imageReference) { this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().withImageReference(imageReference); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineScaleSetImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().withImageReference(imageReferenceInner); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineScaleSetImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().withImageReference(imageReferenceInner); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().osDisk().withImage(userImageVhd); // For platform | custom image osType will be null, azure will pick it from the image metadata. // But for stored image, osType needs to be specified explicitly // this.inner().storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
@Override public VirtualMachineImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().osDisk().withImage(userImageVhd); // For platform | custom image osType will be null, azure will pick it from the image metadata. // But for stored image, osType needs to be specified explicitly // this.inner().storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
@Override public VirtualMachineScaleSetImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner() .virtualMachineProfile() .storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
osProfile.withLinuxConfiguration(new LinuxConfiguration());
osProfile.withLinuxConfiguration(new LinuxConfiguration());
@Override public VirtualMachineScaleSetImpl withStoredLinuxImage(String imageUrl) { VirtualHardDisk userImageVhd = new VirtualHardDisk(); userImageVhd.withUri(imageUrl); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withImage(userImageVhd); // For platform image osType will be null, azure will pick it from the image metadata. this.inner() .virtualMachineProfile() .storageProfile().osDisk().withOsType(OperatingSystemTypes.LINUX); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); return this; }
osProfile.withLinuxConfiguration(new LinuxConfiguration());
osProfile.withLinuxConfiguration(new LinuxConfiguration());