Jeane Freeman told MSPs that the Scottish Government "cannot remove or mitigate all the risks involved with Brexit", but they were working to limit any damaging consequences on the health service in Scotland.
Preparation for a post-Brexit NHS has included the creation of a medicine shortage response group, support for health boards and helping European citizens working in the health service or social care who may be affected if the UK leaves the EU.
Speaking in the Scottish Parliament, Ms Freeman said: "The Scottish Government shares the concerns of health boards on supply continuity, research and workforce. We continue to plan and prepare so we can manage the impact.
"But we need to be clear, we cannot remove or mitigate all the risks involved with Brexit.
"Alongside activation of our Scottish Government resilience room, we've established a health response hub to assist boards, we've written to EU staff and are supporting those staff who are applying for settled status.
"Many medicine supply issues are outside our control, but we have established a medicine shortage response group and are working with NHS national services on medical devices stockpiling."
Responding to a question by Gil Paterson MSP, Ms Freeman added that a no-deal Brexit would cause a "significant shock to our economic system which will, in due course, produce additional demands on our health service".
"With the end of freedom of movement we know that in health, and in particular social care, we will be severely challenged in terms of our workforce.
"It is quite astonishing that in this century, in this country, we are busy working out how to feed and look after our citizens because we are being taken - against our will - out of the European Union."