The Queen has agreed to strip the Duke of York of his honorary military roles and royal patronages, Buckingham Palace has announced.