def get_network_config(self, azure_key_id, update):
        """
        Return None if image type is vm and not update
        Public endpoint should be assigned in real time
        :param service:
        :return:
        """
        azure_service = RequiredFeature("azure_service")

        if self.is_vm_image() and not update:
            return None
        cs = self.virtual_environment[self.T_CLOUD_SERVICE]
        nc = self.virtual_environment[self.T_NETWORK_CONFIG]
        network_config = ConfigurationSet()
        network_config.configuration_set_type = nc[self.T_CONFIGURATION_SET_TYPE]
        input_endpoints = nc[self.T_INPUT_ENDPOINTS]
        # avoid duplicate endpoint under same cloud service
        assigned_endpoints = azure_service.get_assigned_endpoints(azure_key_id, cs[self.SERVICE_NAME])
        endpoints = map(lambda i: i[self.T_LOCAL_PORT], input_endpoints)
        unassigned_endpoints = map(str, find_unassigned_endpoints(endpoints, assigned_endpoints))
        map(lambda (i, u): i.update({self.PORT: u}), zip(input_endpoints, unassigned_endpoints))
        for input_endpoint in input_endpoints:
            network_config.input_endpoints.input_endpoints.append(
                ConfigurationSetInputEndpoint(
                    input_endpoint[self.NAME],
                    input_endpoint[self.PROTOCOL],
                    input_endpoint[self.PORT],
                    input_endpoint[self.T_LOCAL_PORT]
                )
            )
        return network_config