You either quote the entire value or include a second ‘#’.
foo.bar=“my#password” foo.baz=my##password