Trying to script to automate deployement in Azure on VM created on Azure. Everything was just dandy yesterday. I did the setup and alI the services were deploying to their respective subscription.
There were also a number of Azure management certificates hanging around in my certificates area. I've cleared them all out since all but one were very old. I then re-imported the latest publish settings file hoping that by starting from the beginning, everything would be happy again.
And then I logged in today, ran one of my deployment and it said:
The server failed to authenticate the request.
Verify that the certificate is valid and is associated with this subscription.
No problem, just use the handy-dandy add-azureaccount, it logs me back in, re-run the deployment and again it says:
Set-AzureService : ForbiddenError: The server failed to authenticate the
request. Verify that the certificate is valid and is associated with this
subscription.
Does any one has any idea about how to get authenticate to server ?
All this automation I am doing on A VM created on Azure and installed Teamcity on VM. When i try to run the scripts directly on VM Powershell it works fine But the error occurs when i try to run the Teamcity configuration, It fails in PowerShell Build Step.
It though returns the subscriptions that are there on VM by the command Get-AzureSubscription
[11:31:07][Step 3/3] SubscriptionId : *******
[11:31:07][Step 3/3] SubscriptionName : ****
[11:31:07][Step 3/3] Environment : AzureCloud
[11:31:07][Step 3/3] SupportedModes : AzureServiceManagement
[11:31:07][Step 3/3] DefaultAccount : *******
[11:31:07][Step 3/3] Accounts : *******
[11:31:07][Step 3/3] IsDefault : True
[11:31:07][Step 3/3] IsCurrent : True
[11:31:07][Step 3/3] CurrentStorageAccountName : *******
[11:31:07][Step 3/3] TenantId :
[11:31:07][Step 3/3] SubscriptionId : *******
[11:31:07][Step 3/3] SubscriptionName : *******
[11:31:07][Step 3/3] Environment : AzureCloud
[11:31:07][Step 3/3] SupportedModes : AzureServiceManagement
[11:31:07][Step 3/3] DefaultAccount : *******
[11:31:07][Step 3/3] Accounts : *******
[11:31:07][Step 3/3] IsDefault : False
[11:31:07][Step 3/3] IsCurrent : False
[11:31:07][Step 3/3] CurrentStorageAccountName : tarifficapi
[11:31:07][Step 3/3] TenantId :
[11:31:07][Step 3/3]
[11:31:07][Step 3/3]
[11:31:07][Step 3/3]
[11:31:21][Step 3/3] Set-AzureService : ForbiddenError: The server failed to >authenticate the
[11:31:21][Step 3/3] request. Verify that the certificate is valid and is >associated with this
[11:31:21][Step 3/3] subscription.
[11:31:21][Step 3/3] At line:1 char:1
[11:31:21][Step 3/3] + Set-AzureService -ServiceName $service -Label $deploymentLabel
[11:31:21][Step 3/3] + >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [11:31:21][Step 3/3] + CategoryInfo : CloseError: (:) [Set->AzureService], ComputeCloud
[11:31:21][Step 3/3] Exception
[11:31:21][Step 3/3] + FullyQualifiedErrorId : >Microsoft.WindowsAzure.Commands.ServiceManagemen
[11:31:21][Step 3/3] t.HostedServices.SetAzureServiceCommand
Can any one has idea whats going wrong here ?