It has been convention for over a century that, after the death of a senior member of the Royal Family, the courts are asked to seal their wills.
It means that, unlike most wills granted probate, it will not be open to public inspection.
There will be a private process in 90 years to decide if it can be unsealed.
The hearing into the application to seal the will was also held in private in July by Sir Andrew McFarlane, the most senior judge in the family courts.
He heard arguments from lawyers representing the duke's estate and the attorney general, the government's chief legal adviser, and published his ruling on Thursday.
Sir Andrew said that as president of the Family Division of the High Court, he is the custodian of a safe containing more than 30 envelopes, each containing the sealed will of a dead member of the Royal Family.
And for the first time in more than 100 years, he set out a process by which those wills could be made public.
Sir Andrew said: "I have held that, because of the constitutional position of the Sovereign, it is appropriate to have a special practice in relation to royal wills.
"There is a need to enhance the protection afforded to truly private aspects of the lives of this limited group of individuals in order to maintain the dignity of the Sovereign and close members of her family."
The judge said he had not seen Prince Philip's will or been told anything of its contents, other than the date of its execution and the identity of the appointed executor.
He said he decided to hold the hearing in private because it would be likely to generate "very significant publicity and conjecture" that would "defeat the purpose of the application".
"I accepted the submission that, whilst there may be public curiosity as to the private arrangements that a member of the Royal Family may choose to make in their will, there is no true public interest in the public knowing this wholly private information," he said.
He said there was no legal reason for any representations from media organisations because the public interest was represented by the attorney general.
Lawyers for Philip's estate argued that news of the hearing and the application "might generate wholly unfounded conjecture" which would be "deeply intrusive" for the Queen and the Royal Family.
Detailing the history of previous decisions, Sir Andrew said the first family member whose will was sealed by the court was Prince Francis of Teck, the younger brother of Queen Mary, who died in 1910.
According to the legal and royal expert Michael L Nash, author of Royal Wills in Britain from 1509 to 2008, the new legal mechanism was devised after Prince Francis left valuable emeralds prized by Queen Mary to his mistress, the Countess of Kilmorey.
An envelope containing Prince Francis's will resides in the safe held by Sir Andrew, with the most recent additions being those of the late Queen Mother and Princess Margaret, the Queen's sister, who died in 2002.
In 2007, a man claiming to be the illegitimate child of Princess Margaret, Robert Andrew Brown, applied to unseal the wills of the Queen Mother and Princess Margaret but his claim was struck out as "vexatious and an abuse of process".
However, Sir Andrew amended previous orders, which had sealed royal wills indefinitely, so that they can be inspected privately 90 years after probate was granted.
The "grant of probate" is an order that allows someone to distribute a deceased person's assets according to their wishes, and normally marks the point where person's will becomes a public document.
Sir Andrew said after 90 years each royal will would be opened and examined by the monarch's private solicitor, the keeper of the Royal Archives, the attorney general and by any personal representatives of the dead person who may still be available.
They will decide whether the will may be made public at that stage, but Sir Andrew said some royal wills may never be published, even in part.
The unsealing should be conducted by a professional archivist to ensure the documents and seals are properly preserved. Further details of the process will be decided by the court before it begins to unseal the first of the wills.
The Queen's solicitor and the attorney general argued that the wills should be sealed for 125 years, but Sir Andrew said that 90 years was "proportionate and sufficient" and would mean the risk of publication intruding on the private lives of royals would be substantially reduced.
Sir Andrew said he intends to publish an annex listing the names on the 30 envelopes in his safe, but added that he will not do so until any potential appeal against his judgement has been able to run its course.
One name which will not feature is that of Diana, Princess of Wales. Unlike other members of the Royal Family, her will was published after her death in 1997, revealing that the majority of her fortune was being held in trust for her sons until they reached the age of 25.