:doc:`IoT <../../iot>` / Client / attach_principal_policy

***********************
attach_principal_policy
***********************



.. py:method:: IoT.Client.attach_principal_policy(**kwargs)

  

  Attaches the specified policy to the specified principal (certificate or other credential).

   

  **Note:** This action is deprecated and works as expected for backward compatibility, but we won't add enhancements. Use  AttachPolicy instead.

   

  Requires permission to access the `AttachPrincipalPolicy <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  .. danger::

        This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.


  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/AttachPrincipalPolicy>`_  


  **Request Syntax**
  ::

    response = client.attach_principal_policy(
        policyName='string',
        principal='string'
    )
    
  :type policyName: string
  :param policyName: **[REQUIRED]** 

    The policy name.

    

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

    The principal, which can be a certificate ARN (as returned from the CreateCertificate operation) or an Amazon Cognito ID.

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

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

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoT.Client.exceptions.LimitExceededException`

  