Microsoft has explained how not to overpay for cloud resources when working with artificial intelligence.