I deployed cloud service in azure portal. Deployment is successful. And I made some Azure Java sdk codes like below:
ComputeManagementClient cmclient = ComputeManagementService.create(config);
VirtualMachineOperations vmoperat = cmclient.getVirtualMachinesOperations();
VirtualMachineGetResponse vmresp = vmoperat.get("AzurecloudDNS", AzurecloudDNSStaging20160613193121","WorkerRole1_IN_0");
But it throws the following exception,
Exception in thread "main" com.microsoft.windowsazure.exception.ServiceException: ResourceNotFound: Role WorkerRole1_IN_0 was not found in the currently deployed service.
at com.microsoft.windowsazure.exception.ServiceException.createFromXml(ServiceException.java:206)
at com.microsoft.windowsazure.management.compute.VirtualMachineOperationsImpl.get(VirtualMachineOperationsImpl.java:6517)
at com.aaa.azure.JavaClient.main(JavaClient.java:81)
In Azure portal, I can see WorkerRole1_IN_0 is working in this cloud service. But it throws exception.
Explaining for the difference between Azure classic portal and Azure new portal, which using different model to create cloud service and virtual machine.
On Azure classic portal, using ASM mode (Azure Service Management) to create Azure services. But using ARM mode (Azure Resource Management) for Azure new portal.
For example, you can refer to the REST APIs of different modes to know the difference for getting information of a existing cloud service, please see below.
Get Role
classic REST API on ASM mode, it relate to the Java package com.microsoft.windowsazure.management.compute
.Get information about a virtual machine
REST API on ARM mode, it relate to the Java package com.microsoft.azure.management.compute
.So according to your code, you are using the Service Management SDK to get information for a cloud service created on classic portal, not for a cloud service created on new portal, because the cloud services created on different modes have different model structures.