Closed jackting73 closed 7 years ago
Hi @jackting73
From my side I tried to reproduce the error for two Azure VMs (one created through Azure portal and the other one created through 'knife azure server create' command) by making API calls for Get-Deployment operation but I got 200OK as the status, but I ran into the same error as you got when I gave incorrect value for field like DeploymentName. So, could you please provide me the command(s) that you invoked through Untitled1.ps1 file so that I can figure out the exact issue.
Hi @Aliasgar16
I follow this article to get the information : http://blogs.msdn.com/b/kaushal/archive/2015/06/02/azure-rest-api-amp-powershell-retrieve-cloud-service-configuration.aspx
My untitled1.ps1 file contents as below: (you should replace the subscription id and thumbprint with yours)
$method = "GET" $headerDate = '2014-05-01' $headers = @{"x-ms-version"="$headerDate"}
$cloudservice = "dnsbychefknife" $deployment = "chefknifenode00" $ContentType = "application/xml"
$subID = "your subscription id" $URI = "https://management.core.windows.net/$subID/services/hostedservices/$cloudservice/deployments/$deployment"
$cert = (Get-ChildItem Cert:\CurrentUser\My | ?{$_.Thumbprint -eq "your thumbprint"}).GetRawCertData()
$body = "n$([convert]::ToBase64String($cert))
n-----END CERTIFICATE-----
$mgmtCertThumb = (Get-AzureSubscription -Current).Certificate.Thumbprint
$url = Invoke-RestMethod -Uri $URI -Method $method -Headers $headers -CertificateThumbprint "your thumbprint" -ContentType $ContentType
$url.Deployment.RoleList.Role.ResourceExtensionReferences.ResourceExtensionReference
Hi @jackting73
...deployments/DeploymentName
we must use the Name element value for the cloud service that we get under the response for the request done through .../deploymentslots/production
.Let me know your response on this.
Thanks
@jackting73 , could you please verify if things are working for you using the suggestions provided above?
Hi @Aliasgar16 ,
I follow your suggestion to create a VM by Azure which the DNS name and Deployment name are the same with "azurechefnode" then it works (I can get the slot and deployment names)
However, when I created a VM by knife which the DNS name and Deployment name are the same with "jackabcd" then it failed. (I tried to use base64-encoding, but still failed)
So, we guess it could be the response format which the VM was created by knife not the same with the spec on https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx
Please help verify the xml response format or anything possible. Thanks.
Hi @jackting73 ,
Thanks
Hi @jackting73
Please find below the XML response when created VM through knife-azure:
INFO: calling post hostedservices/ali-knife/deployments synchronously
DEBUG: <?xml version="1.0"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>ali-knife</Name>
<DeploymentSlot>Production</DeploymentSlot>
<Label>YWxpLWtuaWZl</Label>
<RoleList>
<Role i:type="PersistentVMRole">
<RoleName>ali-knife</RoleName>
<OsVersion i:nil="true"/>
<RoleType>PersistentVMRole</RoleType>
<ConfigurationSets>
<ConfigurationSet i:type="WindowsProvisioningConfigurationSet">
<ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType>
<ComputerName>ali-knife</ComputerName>
<AdminPassword>****</AdminPassword>
<ResetPasswordOnFirstLogon>false</ResetPasswordOnFirstLogon>
<EnableAutomaticUpdates>false</EnableAutomaticUpdates>
<AdminUsername>azure</AdminUsername>
</ConfigurationSet>
<ConfigurationSet i:type="NetworkConfigurationSet">
<ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>
<InputEndpoints/>
</ConfigurationSet>
</ConfigurationSets>
<ResourceExtensionReferences>
<ResourceExtensionReference>
<ReferenceName>ChefClient</ReferenceName>
<Publisher>Chef.Bootstrap.WindowsAzure</Publisher>
<Name>ChefClient</Name>
<Version>1210.12</Version>
<ResourceExtensionParameterValues>
<ResourceExtensionParameterValue>
<Key>PublicParams</Key>
<Value>****</Value>
<Type>Public</Type>
</ResourceExtensionParameterValue>
<ResourceExtensionParameterValue>
<Key>PrivateParams</Key>
<Value>****</Value>
<Type>Private</Type>
</ResourceExtensionParameterValue>
</ResourceExtensionParameterValues>
<State>Enable</State>
</ResourceExtensionReference>
</ResourceExtensionReferences>
<Label>YWxpLWtuaWZl</Label>
<OSVirtualHardDisk>
<DiskName>disk_1bc09bb7-246c-4f3c-a6a5-ca2cf32e6704</DiskName>
<MediaLink>http://aliknifekprdecgkbl.blob.core.windows.net/vhds/disk_1bc09bb7-246c-4f3c-a6a5-ca2cf32e6704.vhd</MediaLink>
<SourceImageName>bd507d3a70934695bc2128e3e5a255ba__RightImage-Windows-2012R2-x64-v14.2</SourceImageName>
</OSVirtualHardDisk>
<RoleSize>Small</RoleSize>
<ProvisionGuestAgent>true</ProvisionGuestAgent>
</Role>
</RoleList>
</Deployment>
Thanks
@jackting73 re-open if you are still facing this issue.
https://msdn.microsoft.com/en-us/library/azure/ee460804.aspx
We can get the right format and value of Azure REST api (Get-Deployment) if created the VM by Azure. By Powershell to get Ge-Deployment : By Azure JAVA SDK to get Get-Deployment :
However, we found it failed with wrong format and value if created by knife-azure. By Powershell to get Ge-Deployment : By Azure JAVA SDK to get Ge-Deployment :
The wrong format of Get-Deployment create by knife-azure :