As the end-users increasingly can provide flexibility to the power system, it is important to consider how this flexibility can be activated as a resource for the grid. Electricity network tariffs are one option that can be used to activate this flexibility. Therefore, by designing efficient grid tariffs, it might be possible to reduce the total costs in the power system by incentivizing a change in consumption patterns. This paper provides a methodology for optimal grid tariff design under decentralized decision-making and uncertainty in demand, power prices, and renewable generation. A bilevel model is formulated to adequately describe the interaction between the end-users and a distribution system operator. In addition, a centralized decision-making model is provided for benchmarking purposes. The bilevel model is reformulated as a mixed-integer linear problem solvable by branch-and-cut techniques. Results for a deterministic example and a stochastic case study are presented and discussed.