I am using Azure Management Cmdlets version 1.0.
I run the following PowerShell script
New-Deployment -subscriptionId bef7722c-1a开发者_运维百科13-4c9f-b7f6-fafc0a958b35 -certificate D:\pcg\T.cer -serviceName 1ClickDeploymentTest -slot Production -package D:\pcg
\CloudTodorTest.cspkg -configuration D:\pcg\ServiceConfiguration.cscfg -label lbl1 -StorageServiceName TodorTestStorage
where the D:\pcg\T.cert is the certificate which is already uploaded to Azure too. The package and the configuration are the local copies of the application that is already running on Azure. I've tried to deploy them manually and they are working.
After executing this script I receive the following error message:
PS C:\Windows\SysWOW64\WindowsPowerShell\v1.0> D:\PSScripts\dt2.ps1 New-Deployment : The remote server returned an unexpected response: (400) Bad Request. At D:\PSScripts\dt2.ps1:1 char:15 + New-Deployment <<<< -subscriptionId bef7722c-1a13-4c9f-b7f6-fafc0a958b35 -certificate D:\pcg\T.cer -serviceName 1Cli ckDeploymentTest -slot Staging -package D:\pcg\CloudTodorTest.cspkg -configuration D:\pcg\ServiceConfiguration.cscfg -l abel lbl1 -StorageServiceName TodorTestStorage | Get-OperationStatus -WaitToComplete + CategoryInfo : CloseError: (:) [New-Deployment], ProtocolException + FullyQualifiedErrorId : Microsoft.Samples.AzureManagementTools.PowerShell.HostedServices.NewDeploymentCommand
I can execute other cmdlets. For example to check the current deployments.
Check the case of the service name and deployment slot and other parameters you're specifying - I seem to recall that the service name has to be all lower case because it is used in DNS.
The Azure API is very finicky about case sensitivity of some of the arguments, and if you get it wrong you'll get a Bad Request response with no further info.
If the problem were with the subscription id or the certificate, you'd get a Not Authorized response. I think you've gotten past authorization and are failing because something in the request itself is invalid.
Storage accounts have to be lowercase. I'm not sure that's your issue (maybe the cmdlets auto-lowercase it), but it's something to try.
精彩评论