Create GCP and Firebase Project with Service Account Without Organization or Folder










0















I have a need to use a Google Cloud Platform (GCP) Service Account to create Projects programmatically through the Resource Manager REST API. I want to create Firebase projects in a headless manner.



Our current solution involves imitating a user and browser to achieve this because it does not appear possible to create a Project as a Service Account through the GCP Resource Manager REST API without an Organization (or a Folder, which must be under an Organization).



When I attempt to create a Project as a Service Account, I receive a 403 Bad Request response saying, "Service accounts cannot create projects without a parent".



Attempting to create a Project as a Service Account with an empty Parent produces a 400 Bad Request response saying, "Request contains an invalid argument".



Attempting to create a Project as a Service Account with a Parent whose Type is "organization" without an Id produces a 400 Bad Request response saying, "Parent id must be numeric".



Since I don't have an Organization (calls to organizations.list return ) and I can't create one without a domain, I'm unsure how to proceed down this path.










share|improve this question
























  • To give you a great answer, it might help us if you have a glance at How to Ask if you haven't already. It might be also useful if you could provide a Minimal, Complete, and Verifiable example.

    – Mat
    Nov 13 '18 at 16:10















0















I have a need to use a Google Cloud Platform (GCP) Service Account to create Projects programmatically through the Resource Manager REST API. I want to create Firebase projects in a headless manner.



Our current solution involves imitating a user and browser to achieve this because it does not appear possible to create a Project as a Service Account through the GCP Resource Manager REST API without an Organization (or a Folder, which must be under an Organization).



When I attempt to create a Project as a Service Account, I receive a 403 Bad Request response saying, "Service accounts cannot create projects without a parent".



Attempting to create a Project as a Service Account with an empty Parent produces a 400 Bad Request response saying, "Request contains an invalid argument".



Attempting to create a Project as a Service Account with a Parent whose Type is "organization" without an Id produces a 400 Bad Request response saying, "Parent id must be numeric".



Since I don't have an Organization (calls to organizations.list return ) and I can't create one without a domain, I'm unsure how to proceed down this path.










share|improve this question
























  • To give you a great answer, it might help us if you have a glance at How to Ask if you haven't already. It might be also useful if you could provide a Minimal, Complete, and Verifiable example.

    – Mat
    Nov 13 '18 at 16:10













0












0








0








I have a need to use a Google Cloud Platform (GCP) Service Account to create Projects programmatically through the Resource Manager REST API. I want to create Firebase projects in a headless manner.



Our current solution involves imitating a user and browser to achieve this because it does not appear possible to create a Project as a Service Account through the GCP Resource Manager REST API without an Organization (or a Folder, which must be under an Organization).



When I attempt to create a Project as a Service Account, I receive a 403 Bad Request response saying, "Service accounts cannot create projects without a parent".



Attempting to create a Project as a Service Account with an empty Parent produces a 400 Bad Request response saying, "Request contains an invalid argument".



Attempting to create a Project as a Service Account with a Parent whose Type is "organization" without an Id produces a 400 Bad Request response saying, "Parent id must be numeric".



Since I don't have an Organization (calls to organizations.list return ) and I can't create one without a domain, I'm unsure how to proceed down this path.










share|improve this question
















I have a need to use a Google Cloud Platform (GCP) Service Account to create Projects programmatically through the Resource Manager REST API. I want to create Firebase projects in a headless manner.



Our current solution involves imitating a user and browser to achieve this because it does not appear possible to create a Project as a Service Account through the GCP Resource Manager REST API without an Organization (or a Folder, which must be under an Organization).



When I attempt to create a Project as a Service Account, I receive a 403 Bad Request response saying, "Service accounts cannot create projects without a parent".



Attempting to create a Project as a Service Account with an empty Parent produces a 400 Bad Request response saying, "Request contains an invalid argument".



Attempting to create a Project as a Service Account with a Parent whose Type is "organization" without an Id produces a 400 Bad Request response saying, "Parent id must be numeric".



Since I don't have an Organization (calls to organizations.list return ) and I can't create one without a domain, I'm unsure how to proceed down this path.







firebase google-cloud-platform






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 17:39









Maxim

1,498210




1,498210










asked Nov 13 '18 at 16:03









ZACommandoZACommando

32




32












  • To give you a great answer, it might help us if you have a glance at How to Ask if you haven't already. It might be also useful if you could provide a Minimal, Complete, and Verifiable example.

    – Mat
    Nov 13 '18 at 16:10

















  • To give you a great answer, it might help us if you have a glance at How to Ask if you haven't already. It might be also useful if you could provide a Minimal, Complete, and Verifiable example.

    – Mat
    Nov 13 '18 at 16:10
















To give you a great answer, it might help us if you have a glance at How to Ask if you haven't already. It might be also useful if you could provide a Minimal, Complete, and Verifiable example.

– Mat
Nov 13 '18 at 16:10





To give you a great answer, it might help us if you have a glance at How to Ask if you haven't already. It might be also useful if you could provide a Minimal, Complete, and Verifiable example.

– Mat
Nov 13 '18 at 16:10












1 Answer
1






active

oldest

votes


















1














Q: How do you create Google Cloud Platform (GCP) projects programmatically using a service account without having a GCP Organization?



A: You can't.




An actual gmail.com user can create projects in No Organization, but a Service Account must specify an organization or a folder as the parent at project creation time.



Your current solution of doing it as a user is probably the only real workaround. For that, you would use an OAuth2 ClientID and Secret to obtain offline credentials for the user with the https://www.googleapis.com/auth/cloud-platform scope. Then, you can use that refresh_token to generate access_tokens that you use to call the Cloud Resource Manager API to create projects.



However, I would make a strong case for the Organization. If you can obtain a domain, you can use that domain to setup Cloud Identity and get an Organization resource. Then, you can grant the Service Account the Project Creator role on your Organization resource and it will be able to programmatically create projects.



The win here is that all the projects you create with this Service Account will be under a single Organization so you can easily grant permissions and manage access across all of the projects in a single place. A new person joins your team, and instead having to grant them access to each of your Firebase or GCP projects one at a time, you can do it by adding a single permission to the Organization resource.



More: Granting, Changing, and Revoking Access to Resources






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284949%2fcreate-gcp-and-firebase-project-with-service-account-without-organization-or-fol%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Q: How do you create Google Cloud Platform (GCP) projects programmatically using a service account without having a GCP Organization?



    A: You can't.




    An actual gmail.com user can create projects in No Organization, but a Service Account must specify an organization or a folder as the parent at project creation time.



    Your current solution of doing it as a user is probably the only real workaround. For that, you would use an OAuth2 ClientID and Secret to obtain offline credentials for the user with the https://www.googleapis.com/auth/cloud-platform scope. Then, you can use that refresh_token to generate access_tokens that you use to call the Cloud Resource Manager API to create projects.



    However, I would make a strong case for the Organization. If you can obtain a domain, you can use that domain to setup Cloud Identity and get an Organization resource. Then, you can grant the Service Account the Project Creator role on your Organization resource and it will be able to programmatically create projects.



    The win here is that all the projects you create with this Service Account will be under a single Organization so you can easily grant permissions and manage access across all of the projects in a single place. A new person joins your team, and instead having to grant them access to each of your Firebase or GCP projects one at a time, you can do it by adding a single permission to the Organization resource.



    More: Granting, Changing, and Revoking Access to Resources






    share|improve this answer



























      1














      Q: How do you create Google Cloud Platform (GCP) projects programmatically using a service account without having a GCP Organization?



      A: You can't.




      An actual gmail.com user can create projects in No Organization, but a Service Account must specify an organization or a folder as the parent at project creation time.



      Your current solution of doing it as a user is probably the only real workaround. For that, you would use an OAuth2 ClientID and Secret to obtain offline credentials for the user with the https://www.googleapis.com/auth/cloud-platform scope. Then, you can use that refresh_token to generate access_tokens that you use to call the Cloud Resource Manager API to create projects.



      However, I would make a strong case for the Organization. If you can obtain a domain, you can use that domain to setup Cloud Identity and get an Organization resource. Then, you can grant the Service Account the Project Creator role on your Organization resource and it will be able to programmatically create projects.



      The win here is that all the projects you create with this Service Account will be under a single Organization so you can easily grant permissions and manage access across all of the projects in a single place. A new person joins your team, and instead having to grant them access to each of your Firebase or GCP projects one at a time, you can do it by adding a single permission to the Organization resource.



      More: Granting, Changing, and Revoking Access to Resources






      share|improve this answer

























        1












        1








        1







        Q: How do you create Google Cloud Platform (GCP) projects programmatically using a service account without having a GCP Organization?



        A: You can't.




        An actual gmail.com user can create projects in No Organization, but a Service Account must specify an organization or a folder as the parent at project creation time.



        Your current solution of doing it as a user is probably the only real workaround. For that, you would use an OAuth2 ClientID and Secret to obtain offline credentials for the user with the https://www.googleapis.com/auth/cloud-platform scope. Then, you can use that refresh_token to generate access_tokens that you use to call the Cloud Resource Manager API to create projects.



        However, I would make a strong case for the Organization. If you can obtain a domain, you can use that domain to setup Cloud Identity and get an Organization resource. Then, you can grant the Service Account the Project Creator role on your Organization resource and it will be able to programmatically create projects.



        The win here is that all the projects you create with this Service Account will be under a single Organization so you can easily grant permissions and manage access across all of the projects in a single place. A new person joins your team, and instead having to grant them access to each of your Firebase or GCP projects one at a time, you can do it by adding a single permission to the Organization resource.



        More: Granting, Changing, and Revoking Access to Resources






        share|improve this answer













        Q: How do you create Google Cloud Platform (GCP) projects programmatically using a service account without having a GCP Organization?



        A: You can't.




        An actual gmail.com user can create projects in No Organization, but a Service Account must specify an organization or a folder as the parent at project creation time.



        Your current solution of doing it as a user is probably the only real workaround. For that, you would use an OAuth2 ClientID and Secret to obtain offline credentials for the user with the https://www.googleapis.com/auth/cloud-platform scope. Then, you can use that refresh_token to generate access_tokens that you use to call the Cloud Resource Manager API to create projects.



        However, I would make a strong case for the Organization. If you can obtain a domain, you can use that domain to setup Cloud Identity and get an Organization resource. Then, you can grant the Service Account the Project Creator role on your Organization resource and it will be able to programmatically create projects.



        The win here is that all the projects you create with this Service Account will be under a single Organization so you can easily grant permissions and manage access across all of the projects in a single place. A new person joins your team, and instead having to grant them access to each of your Firebase or GCP projects one at a time, you can do it by adding a single permission to the Organization resource.



        More: Granting, Changing, and Revoking Access to Resources







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 14 '18 at 5:44









        lukwamlukwam

        324110




        324110





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284949%2fcreate-gcp-and-firebase-project-with-service-account-without-organization-or-fol%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

            Darth Vader #20

            Ondo