jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <n...@apache.org>
Subject Re: azurecompute: Deploying a Windows Server
Date Tue, 20 Oct 2015 21:08:54 GMT
You can provide the custom username and password as follows, using the
TemplateBuilder. Note the use of the TemplateOptions and the methods
it provides to override the credentials:

TemplateOptions opts = computeService.templateOptions();
Template template = computeService.templateBuilder()
   .locationId("Australia East")
   .imageId("ad072bd3082149369c449ba5832401ae__Windows-Server-Remote-Desktop-Session-Host-on-Windows-Server-2012-R2-20150828-0350")
   .hardwareId("BASIC_A0")
   .options(opts.overrideLoginUser("user").overrideLoginPassword("password"))
   .build();

If no user or pass is provided, jclouds will use by default "jclouds"
as a username and "Azur3Compute!" as the password.

This said, you should never see the error you provide, but looking at
the code, I'm pretty sure it is a bug in jclouds, as the
"AdminUsername" tag should be set here [1] when deploying Windows VMs.
Mind opening a JIRA issue [2] to track this? And would you want to try
opening a pull request and send your first contribution to jclouds?
The fix should be as easy as adding that tag on the mentioned code
block.

HTH!

I.


[1] https://github.com/jclouds/jclouds-labs/blob/master/azurecompute/src/main/java/org/jclouds/azurecompute/binders/DeploymentParamsToXML.java#L50-L63
[2] https://issues.apache.org/jira/browse/JCLOUDS

On 19 October 2015 at 06:28, Ruben Rubio Rey <tk421.1@gmail.com> wrote:
> Hi,
>
> I am trying to deploy a Windows Server using azurecompute.
>
> I was actually expecting to be able to create a Windows server using the
> standard ComputeService
>
> Template template = computeService.templateBuilder()
>         .locationId("Australia East")
>
> .imageId("ad072bd3082149369c449ba5832401ae__Windows-Server-Remote-Desktop-Session-Host-on-Windows-Server-2012-R2-20150828-0350")
>         .hardwareId("BASIC_A0")
>         .build();
>
> but this code fails because it is expecting admin user name and password
>
> POST
> https://management.core.windows.net/32a55cff-e1c5-435f-9343-MYSUBSCRIPTION/services/hostedservices/inttest-f75/deployments
> HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [<Error
> xmlns="http://schemas.microsoft.com/windowsazure"
> xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Code>BadRequest</Code><Message>The
> value for parameter 'AdminUsername' is null or empty.</Message></Error>
>
> Is there any chance to send this parameter to the template ? I have tried
> several options with no luck.
>
> I saw that the Integration Tests of azurecompute is actually using
> AzureComputeApi directly, in a code that looks like this:
>
> public void createServer() throws Exception {
>     AzureComputeApi azureAPI = this.getAzureComputeApi();
>     DeploymentApi api =
> azureAPI.getDeploymentApiForService("mac1234service");
>     DeploymentParams params = DeploymentParams.builder()
>             .name("mydeployment")
>             .size(RoleSize.Type.A0)
>
> .sourceImageName("MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd")
>
> .mediaLink(URI.create("http://blobs/disks/mydeployment/MSFT__Win2K8R2SP1-120612-1520-121206-01-en-us-30GB.vhd"))
>             .os(OSImage.Type.WINDOWS)
>             .username("username").password("testpwd")
>             .virtualNetworkName("my-virtualNetworkName")
>             .externalEndpoint(inboundTcpToLocalPort(80, 8080))
>             .externalEndpoint(inboundUdpToLocalPort(53, 53))
>             .build();
>     String output = api.create(params);
>     System.out.println("OPUTPUT: " + output);
> }
>
> However no matter what I try my-virtualNetworkName does not exists (even
> when I create it using the Portal). However this code is create a new
> CloudService when I just want to create a VM.
>
> How can I create a new Windows VM ? Ideally, I would like to use
> computeService.templateBuilder(), but any options would be considered.
>
> Regards,
> Ruben

Mime
View raw message