:doc:`ManagedGrafana <../../grafana>` / Client / create_workspace_service_account

********************************
create_workspace_service_account
********************************



.. py:method:: ManagedGrafana.Client.create_workspace_service_account(**kwargs)

  

  Creates a service account for the workspace. A service account can be used to call Grafana HTTP APIs, and run automated workloads. After creating the service account with the correct ``GrafanaRole`` for your use case, use ``CreateWorkspaceServiceAccountToken`` to create a token that can be used to authenticate and authorize Grafana HTTP API calls.

   

  You can only create service accounts for workspaces that are compatible with Grafana version 9 and above.

   

  .. note::

    

    For more information about service accounts, see `Service accounts <https://docs.aws.amazon.com/grafana/latest/userguide/service-accounts.html>`__ in the *Amazon Managed Grafana User Guide*.

     

    For more information about the Grafana HTTP APIs, see `Using Grafana HTTP APIs <https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html>`__ in the *Amazon Managed Grafana User Guide*.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/grafana-2020-08-18/CreateWorkspaceServiceAccount>`_  


  **Request Syntax**
  ::

    response = client.create_workspace_service_account(
        grafanaRole='ADMIN'|'EDITOR'|'VIEWER',
        name='string',
        workspaceId='string'
    )
    
  :type grafanaRole: string
  :param grafanaRole: **[REQUIRED]** 

    The permission level to use for this service account.

     

    .. note::

      

      For more information about the roles and the permissions each has, see `User roles <https://docs.aws.amazon.com/grafana/latest/userguide/Grafana-user-roles.html>`__ in the *Amazon Managed Grafana User Guide*.

      

    

  
  :type name: string
  :param name: **[REQUIRED]** 

    A name for the service account. The name must be unique within the workspace, as it determines the ID associated with the service account.

    

  
  :type workspaceId: string
  :param workspaceId: **[REQUIRED]** 

    The ID of the workspace within which to create the service account.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'grafanaRole': 'ADMIN'|'EDITOR'|'VIEWER',
          'id': 'string',
          'name': 'string',
          'workspaceId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **grafanaRole** *(string) --* 

        The permission level given to the service account.

        
      

      - **id** *(string) --* 

        The ID of the service account.

        
      

      - **name** *(string) --* 

        The name of the service account.

        
      

      - **workspaceId** *(string) --* 

        The workspace with which the service account is associated.

        
  
  **Exceptions**
  
  *   :py:class:`ManagedGrafana.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`ManagedGrafana.Client.exceptions.ThrottlingException`

  
  *   :py:class:`ManagedGrafana.Client.exceptions.ConflictException`

  
  *   :py:class:`ManagedGrafana.Client.exceptions.ValidationException`

  
  *   :py:class:`ManagedGrafana.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`ManagedGrafana.Client.exceptions.InternalServerException`

  
  *   :py:class:`ManagedGrafana.Client.exceptions.ServiceQuotaExceededException`

  