I think Baghdadi knew that he would have to fight the Iranians for Baghdad, and is prepared to do so. He wants Baghdad as the capital of his new Islamist state for symbolic as well as practical reasons. I suspect that the Kenyan is prepared to assist him in this endeavor for the same reasons he was covertly assisting him in Syria: the Kenyan wants to see an a Sunni Islamist state established, and having failed in Egypt sees this as his best opportunity.
I don’t think Iran will let ISIS take Baghdad. This is the best chance Iran will ever have to annex the parts of the-country-formerly-known-as-Iraq where there is Shiite majority population. They would not want Baghdad just a few miles away as capital of some Sunni caliphate.