You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Ruben Rubio Rey <tk...@gmail.com> on 2015/10/19 06:28:21 UTC
azurecompute: Deploying a Windows Server
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
Re: azurecompute: Deploying a Windows Server
Posted by Ignasi Barrera <na...@apache.org>.
Great!
Here:
https://github.com/jclouds/jclouds-labs/blob/master/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java#L101-L104
https://github.com/jclouds/jclouds-labs/blob/master/azurecompute/src/main/java/org/jclouds/azurecompute/compute/AzureComputeServiceAdapter.java#L133-L134
Then when the DeploymentParams class gets serialised, the appropriate
XML is generated.
I.
On 21 October 2015 at 23:29, Ruben Rubio Rey <tk...@gmail.com> wrote:
> Hi,
>
> Thanks for your help. I will send a pull request soon.
>
> Out of curiosity, where is located the block of code that sets the password
> to "Azur3Compute!" ? I am unable to find it.
>
> Regards,
> Ruben
>
> On Wed, Oct 21, 2015 at 8:08 AM, Ignasi Barrera <na...@apache.org> wrote:
>>
>> 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 <tk...@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
>
>
Re: azurecompute: Deploying a Windows Server
Posted by Ruben Rubio Rey <tk...@gmail.com>.
Hi,
Thanks for your help. I will send a pull request soon.
Out of curiosity, where is located the block of code that sets the password
to "Azur3Compute!" ? I am unable to find it.
Regards,
Ruben
On Wed, Oct 21, 2015 at 8:08 AM, Ignasi Barrera <na...@apache.org> wrote:
> 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 <tk...@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
>
Re: azurecompute: Deploying a Windows Server
Posted by Ignasi Barrera <na...@apache.org>.
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 <tk...@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