gcloud identity groups memberships list command not working in github actions - github

I am trying to list members of google group with follow command, however same command is working when run from cloud sdk on my local machine
C:\Program Files (x86)\Google\Cloud SDK>gcloud --project=projectID identity groups memberships list --group-email="groupemail"
When above command is ran from github actions, it throws following error
ERROR: (gcloud.identity.groups.memberships.list) Invalid value for [--group-email]: There is no such a group associated with the specified argument:'groupemail mentioned in command'
Need suggestion on this behavior.
I am trying to list members of google group with follow command, however same command is working when run from cloud sdk on my local machine
C:\Program Files (x86)\Google\Cloud SDK>gcloud --project=projectID identity groups memberships list --group-email="groupemail"
When above command is ran from github actions, it throws following error
ERROR: (gcloud.identity.groups.memberships.list) Invalid value for [--group-email]: There is no such a group associated with the specified argument:'groupemail mentioned in command'
Need suggestion on this behavior.

Related

Error in Google Cloud Shell Commands while working on the lab (Securing Google Cloud with CFT Scorecard)

I am working in a GCP lab (Securing Google Cloud with CFT Scorecard). All instructions for the lab are given.
First I have to run the following two commands to set environment variables
export GOOGLE_PROJECT=$DEVSHELL_PROJECT_ID
export CAI_BUCKET_NAME=cai-$GOOGLE_PROJECT
In the second command given above I don't know what to replace with my own credentials? May be that is the reason I am getting error.
Now I have to enable the "cloudasset.googleapis.com" gcloud service. For this they gave the following command.
gcloud services enable cloudasset.googleapis.com \
--project $GOOGLE_PROJECT
Error for this is given in the screeshot attached herewith:
Error in the serviec enabling command
Next step is to clone the policy: The given command for that is:
git clone https://github.com/forseti-security/policy-library.git
After that they said: "You realize Policy Library enforces policies that are located in the policy-library/policies/constraints folder, in which case you can copy a sample policy from the samples directory into the constraints directory".
and gave this command:
cp policy-library/samples/storage_blacklist_public.yaml policy-library/policies/constraints/
On running this command I received this:
error on running the directory command
Finally they said "Create the bucket that will hold the data that Cloud Asset Inventory (CAI) will export" and gave the following command:
gsutil mb -l us-central1 -p $GOOGLE_PROJECT gs://$CAI_BUCKET_NAME
I am confused in where to replace my own credentials like in the place of project_Id I wrote my own project id.
Also I don't know these errors are ocurring. Kindly help me.
I'm unable to access the tutorial.
What happens if you run the following:
echo ${DEVSHELL_PROJECT_ID}
I suspect you'll get an empty result because I think this environment variable isn't actually set.
I think it should be:
echo ${DEVSHELL_GCLOUD_CONFIG}
Does that return a result?
If so, perhaps try using that variable instead:
export GOOGLE_PROJECT=${DEVSHELL_GCLOUD_CONFIG}
export CAI_BUCKET_NAME=cai-${GOOGLE_PROJECT}
It's not entirely clear to me why this tutorial is using this approach but, if the above works, it may get you further along.
We're you asked to create a Google Cloud Platform project?
As per the shared error, this seems to be because your env variable GOOGLE_PROJECT is not set. You can verify it by using echo $GOOGLE_PROJECT and seeing whether it returns the project ID or not. You could also use echo $DEVSHELL_PROJECT_ID. If that returns the project ID and the former doesn't, it means that you didn't export the variable as stated at the beginning.
If the problem is that GOOGLE_PROJECT doesn't have any value, there are different approaches on how to solve it.
Set the env variable as you explained at the beginning. Obviously this will only work if the variable DEVSHELL_PROJECT_ID is also set.
export GOOGLE_PROJECT=$DEVSHELL_PROJECT_ID
Manually set the project ID into that variable. This is far from ideal because in Qwiklabs they create a new temporal project on every lab, so this would've only worked if you were still on that project. The project ID can be seen on both of your shared screenshots.
export GOOGLE_PROJECT=qwiklabs-gcp-03-c6e1787dc09e
Avoid using the argument --project. According to the documentation, the aforementioned argument is optional and if none is used the command will take the one by default, which will be on the configuration settings. You can get the current project by using this:
gcloud config get-value project
If the previous command matches the project ID you want to use, you can simply issue the following command:
gcloud services enable cloudasset.googleapis.com
Notice that the project ID is not being explicitly mentioned using --project.
Regarding your issue with the GitHub file, I have checked the repository and the file storage_blacklist_public.yaml doesn't seem to be in the directory policy-library/samples. There seems to be a trace that it was once there, but it isn't anymore, they should probably update the lab as it isn't anymore.
About your credentials confusion, you don't have to use your own project ID, just the one given on your lab. If I recall properly all the needed data should be on the left side of the lab. Still, you shouldn't need to authenticate in a normal situation as you are already logged in your temporal project if you are accessing it form the Cloud Shell, which is where you should be doing all this.
Adding this for the later versions
in the gcloud shell you can set a temp variable for the current project id with
PROJECT_ID="$(gcloud config get-value project)"
then use like
--project ${PROJECT_ID}

How to read a local csv file using Azure Data Factory and a self-hosted runtime?

I have a Windows Server VM with the ADF Integration Runtime installed running under a local account called deploy. This account is a member of the local admins group. The server is not domain-joined.
I created a new linked service (File System) and pointed it to a csv file on the root of the C drive as a test. When I test the connection I get Connection failed.
Error occurred when trying to access the file in Folder 'C:\etr.csv', File filter: ''. The directory name is invalid. Activity ID: 1b892702-7cc3-48d5-83c7-c680d6d15afd.
Any ideas on a fix?
The linked service needs to be a folder on the target machine. In your screenshot, change C:\etr.csv to C:\ and then define a new dataset that uses the linked service to select etr.csv.
The dataset represents the structure of the data within the linked data stores, and the linked service defines the connection to the data source. So the linked service should point to the folder instead of file. It should be C:\ instead of C:\etr.csv

Grant permissions to the service account error

Following step by step the example at,
https://cloud.google.com/text-to-speech/docs/reference/libraries#client-libraries-usage-python
on Step2, I get the following error.
D:\google-api-python\py>gcloud projects add-iam-policy-binding [my-project-for-tts] --member "serviceAccount:[tts-python-1]#[my-project-for-tts].iam.gserviceaccount.com" --role "roles/owner"
ERROR: (gcloud.projects.add-iam-policy-binding) INVALID_ARGUMENT: Request contains an invalid argument.
What argument seems to be invalid here?
My intention is to use the Text-to-Speech services by loading a custom input text file and save the output in my local disk. I installed successfully google-sdk and python.
It seems like the square brackets are the invalid argument here. Using my own service account and running your command I get the same error, but removing the the [] runs fine.
If you remove the [] then the command will work fine.
As per the Google Documentation, you need = to provide member and role value. Your command should look like below:
gcloud projects add-iam-policy-binding my-project-for-tts --member='serviceAccount:tts-python-1#my-project-for-tts.iam.gserviceaccount.com' --role='roles/owner'
Also, make sure you are using the latest gcloud package.

gcloud init cli command :ERROR: gcloud crashed (ValueError): the query contains a null character

I am trying to initialize my gcloud settings for a project. But when I run the gcloud init command, it gives error gcloud crashed.
It was previously working but all of sudden today this command crashed. I tried 'gcloud auth login' and pasted the credentials, but it still gives the same error
gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [default] are:
core:
disable_usage_reporting: 'False'
Pick configuration to use:
[1] Re-initialize this configuration [default] with new settings
[2] Create a new configuration
Please enter your numeric choice: 1
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
ERROR: gcloud crashed (ValueError): the query contains a null character
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
The actual results should be like below:
gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [default] are:
core:
account: prajakta#gmail.com
disable_usage_reporting: 'False'
project: default-1234
Pick configuration to use:
[1] Re-initialize this configuration [default] with new settings
[2] Create a new configuration
Please enter your numeric choice: 1
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
Choose the account you would like to use to perform operations for
this configuration:
[1] prajakta#gmail.com
[2] Log in with a new account
Please enter your numeric choice: 1
Pick cloud project to use:
[1] default-1234
[2] abc-project
[3] Create a new project
Please enter numeric choice or text value (must exactly match list
item): 1
Your current project has been set to: [default-1234].
Your Google Cloud SDK is configured and ready to use!
From the output that you included, it appears to have completed successfully:
Your Google Cloud SDK is configured and ready to use!
Are you able to use any commands?
gcloud config list
gcloud auth list
gcloud projects list
It's not clear which operating system you're using but it's probable that either some dependent piece of software was upgraded and caused the break; and|or Cloud SDK (aka gcloud) has upgraded on your machine and it is broken.
You may be best-placed to contact Google Cloud Support, or if you don't have a support contract, to file an issue on Google issue tracker for gcloud here:
https://issuetracker.google.com/issues/new?component=187143
NB You've included your email address and several of your projects in your question, you may wish to redact these as they're not necessary to help answer the question.

Powershell Add Local Group to Local Group

I'm able to properly add a local user to a local group on my machine, but I can't add a local group to another local group. What is the syntax for this?
$targetGroup = [ADSI]"WinNT://$computerName/$targetGroupName,group"
$targetGroup.Add("WinNT://$computerName/$groupName")
The above results in this error:
Exception calling "Add" with "1" argument(s): "A new member could not be added to a local group because the member has the wrong account type.
I'm trying to add a local group to a local group, in Windows Server 2012.
You can nest domain groups, but local group nesting is not supported. This technet article explains in detail.
http://technet.microsoft.com/en-us/library/ee681621(v=ws.10).aspx
Have you considered listing all the users of the "subgroup" and adding them to the target group? This obviously would not create a permanent linking like a sub group would. But it would ensure each member of the "subgroup" are members of the target group at the time the script is run.
Local groups cannot be added to other local groups. This is a limitation of Windows. It's not that you don't have to right code; it just can't be done.
Reference
A local group cannot be found if it is nested inside another group on a Windows Server-based or Windows-based client