1

I installed the Google-Cloud SDK using the install here and selecting the "install for all users" option and checking the box for the powershell tools.

I now have a weird situation whereby if I run PowerShell as admin then run the command:

gcloud --version

I get the expected output:

Google Cloud SDK 213.0.0
beta 2018.07.16
bq 2.0.34
core 2018.08.17
gsutil 4.33

but if I run powershell as a non-elevated user then run the same command I get the pop-up window asking me which application I want to use to open a file, then having selected notepad, for example, windows just opens notepad with a script file starting:

#!/bin/sh
#
# Copyright 2013 Google Inc. All Rights Reserved.
#

# <cloud-sdk-sh-preamble>
#
#  CLOUDSDK_ROOT_DIR  

... etc...

How can I fix this to allow me to run gcloud commands as a non-elevated user?

Stewart_R
  • 13,764
  • 11
  • 60
  • 106

1 Answers1

-2

After installing your Google Cloud SDK tools you need to start your environment. Your active project and credentials aren't propagated to your Cloud Shell, and the user that you want to use needs to have the required permissions for use the GCP resources. Here you have the steps for initializing and configure the Cloud Shell users credentials.

I assume that you are using the Cloud Shell environment and not the Microsoft Powershell tool.

Stewart_R
  • 13,764
  • 11
  • 60
  • 106
HopsHops
  • 55
  • 4
  • 1
    Hi, welcome to SO and thanks for your efforts to assist but I fear you may have made an incorrect assumption. I AM in fact using the powershell tool: https://cloud.google.com/powershell/. My question related to that tools specifically so, unfortunately, this doesn't really answer my question. I was careful to try to add the appropriate tags in my original question. – Stewart_R Nov 02 '18 at 11:33
  • Thank you for your clarification, anyway you still need to initializing your Cloud SDK Shell and run the gcloud init command. The user needs to have permissions for use GCP resources. – HopsHops Nov 02 '18 at 11:51
  • Yes, I understand that we need to run the gcloud init command it's just that this doesn't really seem to be related to my question, I am afraid – Stewart_R Nov 02 '18 at 11:54
  • It’s more related to the environment of the non-elevated user and the permissions for access to the GCP resources. – HopsHops Nov 02 '18 at 12:02
  • I don't think the issue I described is related to permissions for the GCP resources. I mentioned in the original question that I see this behaviour when running `gcloud --version` which doesn't need any GCP project set up or permissions – Stewart_R Nov 02 '18 at 12:04
  • I rolled back the edit where the assumption was removed because (although the assumption was incorrect) your answer was predicated on it – Stewart_R Nov 08 '18 at 16:50
  • The assumption is that you are using the Cloud SDK environment, if you are using linux or powershell commands in the Cloud Shell is secondary, and therefore you have to configure the environment to recognize the users credentials. If the user does not have the necessary permissions at the moment of executing a command, he will not have rights and will download a file with the commands that he has indicated and that he has not been able to use. https://cloud.google.com/tools/powershell/docs/quickstart#authenticate_with_sdk_name_short – HopsHops Nov 09 '18 at 15:58