code: def _create_public_ip(self, public_ip_name, resource_group_name, region):
          
          public_ip_config = {
              'location': region,
              'public_ip_allocation_method': 'Dynamic'
          }
  
          try:
              public_ip_setup = \
                  self.network.public_ip_addresses.create_or_update(
                      resource_group_name, public_ip_name, public_ip_config
                  )
          except Exception as error:
              raise AzureCloudException(
                  'Unable to create public IP: {0}.'.format(error)
              )
  
          return public_ip_setup.result()
docs: Create dynamic public IP address in the resource group.