@@ -52,15 +52,15 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment
5252Assuming the use of the ` DefaultAzureCredential ` credential class, the client can be authenticated using the following code:
5353
5454``` java
55- AzureProfile profile = new AzureProfile (AzureEnvironment . AZURE );
55+ AzureProfile profile = new AzureProfile (AzureCloud . AZURE_PUBLIC_CLOUD );
5656TokenCredential credential = new DefaultAzureCredentialBuilder ()
5757 .authorityHost(profile. getEnvironment(). getActiveDirectoryEndpoint())
5858 .build();
5959ComputeFleetManager manager = ComputeFleetManager
6060 .authenticate(credential, profile);
6161```
6262
63- The sample code assumes global Azure. Please change ` AzureEnvironment.AZURE ` variable if otherwise.
63+ The sample code assumes global Azure. Please change the ` AzureCloud.AZURE_PUBLIC_CLOUD ` variable if otherwise.
6464
6565See [ Authentication] [ authenticate ] for more options.
6666
@@ -99,101 +99,60 @@ fleet = computeFleetManager.fleets()
9999 .define(fleetName)
100100 .withRegion(REGION )
101101 .withExistingResourceGroup(resourceGroupName)
102- .withProperties(
103- new FleetProperties ()
104- .withSpotPriorityProfile(
105- new SpotPriorityProfile ()
106- .withMaintain(false )
107- .withCapacity(1 )
108- .withEvictionPolicy(EvictionPolicy . DELETE )
109- .withAllocationStrategy(SpotAllocationStrategy . LOWEST_PRICE )
110- )
111- .withVmSizesProfile(
112- Arrays . asList(
113- new VmSizeProfile (). withName(" Standard_D4s_v3" )
114- )
115- )
116- .withComputeProfile(
117- new ComputeProfile ()
118- .withBaseVirtualMachineProfile(
119- new BaseVirtualMachineProfile ()
120- .withStorageProfile(
121- new VirtualMachineScaleSetStorageProfile ()
122- .withImageReference(
123- new ImageReference ()
124- .withPublisher(" canonical" )
125- .withOffer(" ubuntu-24_04-lts" )
126- .withSku(" server" )
127- .withVersion(" latest" )
128- )
129- .withOsDisk(
130- new VirtualMachineScaleSetOSDisk ()
131- .withManagedDisk(
132- new VirtualMachineScaleSetManagedDiskParameters ()
133- .withStorageAccountType(StorageAccountTypes . PREMIUM_LRS )
134- )
135- .withOsType(OperatingSystemTypes . LINUX )
136- .withDiskSizeGB(30 )
137- .withCreateOption(DiskCreateOptionTypes . FROM_IMAGE )
138- .withDeleteOption(DiskDeleteOptionTypes . DELETE )
139- .withCaching(CachingTypes . READ_WRITE )
140- )
141- .withDiskControllerType(DiskControllerTypes . SCSI )
142- )
143- .withOsProfile(
144- new VirtualMachineScaleSetOSProfile ()
145- .withComputerNamePrefix(randomPadding())
146- .withAdminUsername(adminUser)
147- .withAdminPassword(adminPwd)
148- .withLinuxConfiguration(
149- new LinuxConfiguration (). withDisablePasswordAuthentication(false )
150- )
151- )
152- .withNetworkProfile(
153- new VirtualMachineScaleSetNetworkProfile ()
154- .withNetworkInterfaceConfigurations(
155- Arrays . asList(
156- new VirtualMachineScaleSetNetworkConfiguration ()
157- .withName(vmName)
158- .withProperties(
159- new VirtualMachineScaleSetNetworkConfigurationProperties ()
160- .withPrimary(true )
161- .withEnableAcceleratedNetworking(false )
162- .withDeleteOption(DeleteOptions . DELETE )
163- .withIpConfigurations(
164- Arrays . asList(
165- new VirtualMachineScaleSetIPConfiguration ()
166- .withName(vmName)
167- .withProperties(
168- new VirtualMachineScaleSetIPConfigurationProperties ()
169- .withPrimary(true )
170- .withSubnet(
171- new ApiEntityReference ()
172- .withId(network. subnets(). get(" default" ). id())
173- )
174- .withLoadBalancerBackendAddressPools(
175- loadBalancer. loadBalancingRules()
176- .get(loadBalancerName + " -lbrule" )
177- .innerModel(). backendAddressPools()
178- )
179- )
180- )
181- )
182- )
183- )
184- )
185- .withNetworkApiVersion(NetworkApiVersion . fromString(" 2024-03-01" ))
186- )
187- )
188- .withComputeApiVersion(" 2024-03-01" )
189- .withPlatformFaultDomainCount(1 )
190- )
191- .withRegularPriorityProfile(new RegularPriorityProfile ()
192- .withAllocationStrategy(RegularPriorityAllocationStrategy . LOWEST_PRICE )
193- .withMinCapacity(1 )
194- .withCapacity(2 )
195- )
196- )
102+ .withProperties(new FleetProperties ()
103+ .withSpotPriorityProfile(new SpotPriorityProfile (). withMaintain(false )
104+ .withCapacity(1 )
105+ .withEvictionPolicy(EvictionPolicy . DELETE )
106+ .withAllocationStrategy(SpotAllocationStrategy . LOWEST_PRICE ))
107+ .withVmSizesProfile(Arrays . asList(new VmSizeProfile (). withName(" Standard_D4s_v3" )))
108+ .withComputeProfile(new ComputeProfile ()
109+ .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile ()
110+ .withStorageProfile(new VirtualMachineScaleSetStorageProfile ()
111+ .withImageReference(new ImageReference (). withPublisher(" canonical" )
112+ .withOffer(" ubuntu-24_04-lts" )
113+ .withSku(" server" )
114+ .withVersion(" latest" ))
115+ .withOsDisk(new VirtualMachineScaleSetOSDisk ()
116+ .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters ()
117+ .withStorageAccountType(StorageAccountTypes . PREMIUM_LRS ))
118+ .withOsType(OperatingSystemTypes . LINUX )
119+ .withDiskSizeGB(30 )
120+ .withCreateOption(DiskCreateOptionTypes . FROM_IMAGE )
121+ .withDeleteOption(DiskDeleteOptionTypes . DELETE )
122+ .withCaching(CachingTypes . READ_WRITE ))
123+ .withDiskControllerType(DiskControllerTypes . SCSI ))
124+ .withOsProfile(new VirtualMachineScaleSetOSProfile (). withComputerNamePrefix(randomPadding())
125+ .withAdminUsername(adminUser)
126+ .withAdminPassword(adminPwd)
127+ .withLinuxConfiguration(
128+ new LinuxConfiguration (). withDisablePasswordAuthentication(false )))
129+ .withNetworkProfile(
130+ new VirtualMachineScaleSetNetworkProfile ()
131+ .withNetworkInterfaceConfigurations(
132+ Arrays . asList(new VirtualMachineScaleSetNetworkConfiguration (). withName(vmName)
133+ .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties ()
134+ .withPrimary(true )
135+ .withEnableAcceleratedNetworking(false )
136+ .withDeleteOption(DeleteOptions . DELETE )
137+ .withIpConfigurations(Arrays
138+ .asList(new VirtualMachineScaleSetIPConfiguration (). withName(vmName)
139+ .withProperties(
140+ new VirtualMachineScaleSetIPConfigurationProperties ()
141+ .withPrimary(true )
142+ .withSubnet(new ApiEntityReference ()
143+ .withId(network. subnets(). get(" default" ). id()))
144+ .withLoadBalancerBackendAddressPools(
145+ loadBalancer. loadBalancingRules()
146+ .get(loadBalancerName + " -lbrule" )
147+ .innerModel()
148+ .backendAddressPools())))))))
149+ .withNetworkApiVersion(NetworkApiVersion . fromString(" 2024-03-01" ))))
150+ .withComputeApiVersion(" 2024-03-01" )
151+ .withPlatformFaultDomainCount(1 ))
152+ .withRegularPriorityProfile(new RegularPriorityProfile ()
153+ .withAllocationStrategy(RegularPriorityAllocationStrategy . LOWEST_PRICE )
154+ .withMinCapacity(1 )
155+ .withCapacity(2 )))
197156 .create();
198157```
199158[ Code snippets and samples] ( https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/computefleet/azure-resourcemanager-computefleet/SAMPLE.md )
@@ -226,5 +185,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
226185[ cg ] : https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md
227186[ coc ] : https://opensource.microsoft.com/codeofconduct/
228187[ coc_faq ] : https://opensource.microsoft.com/codeofconduct/faq/
229-
230-
0 commit comments