powershell - The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription -
trying script automate deployement in azure on vm created on azure. dandy yesterday. did setup , ali services deploying respective subscription.
there number of azure management certificates hanging around in certificates area. i've cleared them out since 1 old. re-imported latest publish settings file hoping starting beginning, happy again.
and logged in today, ran 1 of deployment , said:
the server failed authenticate request. verify certificate valid , associated subscription.
no problem, use handy-dandy add-azureaccount, logs me in, re-run deployment , again says:
set-azureservice : forbiddenerror: server failed authenticate request. verify certificate valid , associated subscription.
does 1 has idea how authenticate server ?
all automation doing on vm created on azure , installed teamcity on vm. when try run scripts directly on vm powershell works fine error occurs when try run teamcity configuration, fails in powershell build step.
it though returns subscriptions there on vm 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: server failed >authenticate
[11:31:21][step 3/3] request. verify certificate valid , >associated
[11:31:21][step 3/3] subscription.
[11:31:21][step 3/3] @ 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 1 has idea whats going wrong here ?
i got solution
the error message got was
set-azureservice : forbiddenerror: server failed authenticate request. verify certificate valid , associated >subscription.
it’s bit misleading because can see in code below (esp: last line), did set current storage why did message?
[05:14:33][step 3/3] set-azureservice : forbiddenerror: server failed >authenticate [05:14:33][step 3/3] request. verify certificate valid , >associated [05:14:33][step 3/3] subscription. [05:14:33][step 3/3] @ line:1 char:1 [05:14:33][step 3/3] + set-azureservice -servicename $service -label >$deploymentlabel [05:14:33][step 3/3] + >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [05:14:33][step 3/3] + categoryinfo : closeerror: (:) [set->azureservice], computecloud [05:14:33][step 3/3] exception [05:14:33][step 3/3] + fullyqualifiederrorid : >microsoft.windowsazure.commands.servicemanagemen [05:14:33][step 3/3] t.hostedservices.setazureservicecommand
the script working fine when run in vm powershell failed when run teamcity.
to resolve followed following steps :
open windows powershell on vm
- run "get-azurepublishsettingsfile". ask login azure , publish setting file azure subscription associated account.
- then run "add-azureaccount", ask login , account added powershell. login azure portal (manage.windowsazure.com).
- go settings => management certificates section. thumbprint of added publishsettingcertificate.
- on powershell run import-azurepublishsettingsfile "path of publish setting file on vm"
- run add-azurecertificate -servicename "your service name" -certtodeploy (get-item cert:\currentuser\my"certificate thumbprint got azure") "get-azuresubscription", see subscriptions added on powershell.
hope helps 1 :)
Comments
Post a Comment